From 0ff7ca94a608663649defc72021062de098853a8 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sat, 30 Jan 2016 15:44:03 +0100 Subject: giscanner: Disable warnings arising from -D_FORTIFY_SOURCE -O0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using distutils.ccompiler means that we are forced to use the CFLAGS from the system’s Python installation, which may contain -D_FORTIFY_SOURCE. The user’s environment-provided CFLAGS may contain -O0 (because they are a developer). These two flags cause a warning when used together. Silence that warning by passing -Wno-cpp to disable warnings from #warning preprocessor statements in the generated C code. It doesn’t seem to be possible to selectively undefine _FORTIFY_SOURCE or to stop using the compiler flags from distutils.sysconfig, unfortunately. https://bugzilla.gnome.org/show_bug.cgi?id=757934 --- giscanner/ccompiler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 9b27f0e1..574f40cb 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -229,6 +229,12 @@ class CCompiler(object): extra_postargs.append('-Wall') extra_postargs.append(self._cflags_no_deprecation_warnings) + # Disable warnings from combining _FORTIFY_SOURCE (from + # distutils.sysconfig) and -O0 (potentially provided in CFLAGS by the + # user). + if isinstance(self.compiler, UnixCCompiler): + extra_postargs.append('-Wno-cpp') + includes.extend(include_paths) extra_postargs.extend(extra_args) -- cgit v1.2.1