diff --git a/.travis.yml b/.travis.yml index 8086fffd74714ef8c45de464c585a21d6c22bc74..d91d5443b58ecb3fd973e79ca22bfc224b53ec23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,20 @@ -language: python +os: linux dist: trusty sudo: false +addons: + apt: + packages: + - gdb + - python-dbg + - python3-dbg + cache: pip: true directories: - $HOME/.ccache +language: python python: - 2.7 - 3.6 @@ -30,17 +38,67 @@ env: - BACKEND=c - BACKEND=cpp +matrix: + include: + - os: osx + osx_image: xcode6.4 + env: BACKEND=c PY=2 + python: 2 + language: c + compiler: clang + cache: false + - os: osx + osx_image: xcode6.4 + env: BACKEND=cpp PY=2 + python: 2 + language: cpp + compiler: clang + cache: false + - os: osx + osx_image: xcode6.4 + env: BACKEND=c PY=3 + python: 3 + language: c + compiler: clang + cache: false + - os: osx + osx_image: xcode6.4 + env: BACKEND=cpp PY=3 + python: 3 + language: cpp + compiler: clang + cache: false + allow_failures: + - python: pypy + - python: pypy3 + - python: 3.6-dev + - python: 3.7-dev + exclude: + - python: pypy + env: BACKEND=cpp + - python: pypy3 + env: BACKEND=cpp + branches: only: - master - release +before_install: + - | + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then # Install Miniconda + curl -s -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda$PY-latest-MacOSX-x86_64.sh; + bash miniconda.sh -b -p $HOME/miniconda && rm miniconda.sh; + export PATH="$HOME/miniconda/bin:$PATH"; hash -r; + #conda install --quiet --yes nomkl --file=test-requirements.txt --file=test-requirements-cpython.txt; + fi + install: - python -c 'import sys; print("Python %s" % (sys.version,))' - if [ -n "${TRAVIS_PYTHON_VERSION##*-dev}" -a -n "${TRAVIS_PYTHON_VERSION##2.6*}" ]; then pip install -r test-requirements.txt $( [ -z "${TRAVIS_PYTHON_VERSION##pypy*}" ] || echo " -r test-requirements-cpython.txt" ) ; fi - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build -before_script: ccache -s +before_script: ccache -s || true script: - PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg" @@ -48,22 +106,3 @@ script: - if [ false && "$BACKEND" = "cpp" ]; then pip install pythran; fi # disabled: needs Pythran > 0.8.1 - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i - CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND -j7 - -matrix: - allow_failures: - - python: pypy - - python: pypy3 - - python: 3.6-dev - - python: 3.7-dev - exclude: - - python: pypy - env: BACKEND=cpp - - python: pypy3 - env: BACKEND=cpp - -addons: - apt: - packages: - - gdb - - python-dbg - - python3-dbg diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index b82511c1b96d1ad83ef9928f84ef16ca82431d52..c8b154df34a9d2ad92bbf49977d4efa9e3bf7572 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -270,16 +270,25 @@ #define CYTHON_FALLTHROUGH [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH - #if (defined(__GNUC__) || defined(__clang__)) && __has_attribute(fallthrough) + #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif + + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 /* Xcode < 7.0 */ + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif #endif /////////////// CInitCode /////////////// @@ -1040,7 +1049,7 @@ static int __Pyx_RegisterCleanup(void); /*proto*/ //@substitute: naming //@requires: ImportExport.c::ModuleImport -#if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 || CYTHON_COMPILING_IN_PYPY static PyObject* ${cleanup_cname}_atexit(PyObject *module, CYTHON_UNUSED PyObject *unused) { ${cleanup_cname}(module); Py_INCREF(Py_None); return Py_None; @@ -1113,7 +1122,7 @@ bad: #else // fake call purely to work around "unused function" warning for __Pyx_ImportModule() static int __Pyx_RegisterCleanup(void) { - if ((0)) __Pyx_ImportModule(NULL); + (void)__Pyx_ImportModule; /* unused */ return 0; } #endif diff --git a/Demos/embed/Makefile b/Demos/embed/Makefile index f00697f1a79180821e2409629bb186dc1e24814e..e8d40b999d956b2741f5ce6d6e2f88954a94c710 100644 --- a/Demos/embed/Makefile +++ b/Demos/embed/Makefile @@ -1,6 +1,7 @@ # Makefile for creating our standalone Cython program PYTHON := python PYVERSION := $(shell $(PYTHON) -c "import sys; print(sys.version[:3])") +PYPREFIX := $(shell $(PYTHON) -c "import sys; print(sys.prefix)") INCDIR := $(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_python_inc())") PLATINCDIR := $(shell $(PYTHON) -c "from distutils import sysconfig; print(sysconfig.get_python_inc(plat_specific=True))") @@ -31,5 +32,5 @@ clean: @rm -f *~ *.o *.so core core.* *.c embedded test.output test: clean all - LD_LIBRARY_PATH=$(LIBDIR1):$$LD_LIBRARY_PATH ./embedded > test.output + PYTHONHOME=$(PYPREFIX) LD_LIBRARY_PATH=$(LIBDIR1):$$LD_LIBRARY_PATH ./embedded > test.output $(PYTHON) assert_equal.py embedded.output test.output diff --git a/runtests.py b/runtests.py index d9b661ba8ea37a2ce5b14bcd974544cfae835c44..b8b052c9748b0f7673d42aa9a02a60dcb6517ab5 100755 --- a/runtests.py +++ b/runtests.py @@ -253,7 +253,6 @@ def update_cpp11_extension(ext): update cpp11 extensions that will run on versions of gcc >4.8 """ gcc_version = get_gcc_version(ext.language) - compiler_version = gcc_version.group(1) if gcc_version is not None: compiler_version = gcc_version.group(1) if float(compiler_version) > 4.8: @@ -2089,6 +2088,13 @@ def runtests(options, cmd_args, coverage=None): sys.stderr.write("Backends: %s\n" % ','.join(backends)) languages = backends + if 'TRAVIS' in os.environ and sys.platform == 'darwin' and 'cpp' in languages: + bugs_file_name = 'travis_macos_cpp_bugs.txt' + exclude_selectors += [ + FileListExcluder(os.path.join(ROOTDIR, bugs_file_name), + verbose=verbose_excludes) + ] + if options.use_common_utility_dir: common_utility_dir = os.path.join(WORKDIR, 'utility_code') if not os.path.exists(common_utility_dir): diff --git a/tests/travis_macos_cpp_bugs.txt b/tests/travis_macos_cpp_bugs.txt new file mode 100644 index 0000000000000000000000000000000000000000..17c5d40668af7751bed3b2cc4338e274340b5ad4 --- /dev/null +++ b/tests/travis_macos_cpp_bugs.txt @@ -0,0 +1,9 @@ +complex_numbers_T305 +complex_numbers_c99_T398 +complex_numbers_cpp +complex_numbers_cxx_T398 +cpdef_extern_func +cpp_classes_def +cpp_smart_ptr +cpp_stl_conversion +cpp_stl_function