From 770222a36789fa1e5de0b564e7840ebe7684103a Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Tue, 23 Dec 2008 11:18:16 -0200 Subject: [PATCH] fix distutils GCC compilation flags to remove -Wstrict-prototypes for the C++ case --- runtests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/runtests.py b/runtests.py index 7538cf70..41625b62 100644 --- a/runtests.py +++ b/runtests.py @@ -6,7 +6,7 @@ WITH_CYTHON = True from distutils.dist import Distribution from distutils.core import Extension -from distutils.command.build_ext import build_ext +from distutils.command.build_ext import build_ext as _build_ext distutils_distro = Distribution() TEST_DIRS = ['compile', 'errors', 'run', 'pyregr'] @@ -26,6 +26,14 @@ VER_DEP_MODULES = { INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ] CFLAGS = os.getenv('CFLAGS', '').split() +class build_ext(_build_ext): + def build_extension(self, ext): + if ext.language == 'c++': + try: + self.compiler.compiler_so.remove('-Wstrict-prototypes') + except Exception: + pass + _build_ext.build_extension(self, ext) class ErrorWriter(object): match_error = re.compile('(warning:)?(?:.*:)?\s*([-0-9]+)\s*:\s*([-0-9]+)\s*:\s*(.*)').match @@ -259,12 +267,13 @@ class CythonCompileTestCase(unittest.TestCase): if incdir: build_extension.include_dirs.append(incdir) build_extension.finalize_options() - extension = Extension( module, sources = [self.build_target_filename(module)], extra_compile_args = CFLAGS, ) + if self.language == 'cpp': + extension.language = 'c++' build_extension.extensions = [extension] build_extension.build_temp = workdir build_extension.build_lib = workdir -- 2.26.2