summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-01-30 15:44:03 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2016-01-30 15:44:03 +0100
commit0ff7ca94a608663649defc72021062de098853a8 (patch)
tree6d13df9d398ba68ed591ebff20c065c35ffc5f68
parentc598d73125c7fd6577ea911c103bf63fb23f0813 (diff)
downloadgobject-introspection-0ff7ca94a608663649defc72021062de098853a8.tar.gz
giscanner: Disable warnings arising from -D_FORTIFY_SOURCE -O0
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
-rw-r--r--giscanner/ccompiler.py6
1 files changed, 6 insertions, 0 deletions
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)