aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-08-23 18:48:55 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-08-23 21:01:16 -0400
commit1dce556dc25c15eeaad4847c5e49fb5ee5eda8cb (patch)
tree2f96f82859efc50f4429f18d6f7641045d99142b
parentb3c240989bde292e561b7f905f008d9da4aa6668 (diff)
downloadmeson-1dce556dc25c15eeaad4847c5e49fb5ee5eda8cb.zip
meson-1dce556dc25c15eeaad4847c5e49fb5ee5eda8cb.tar.gz
meson-1dce556dc25c15eeaad4847c5e49fb5ee5eda8cb.tar.bz2
gnome: don't let fortify defines into the g-ir-scanner after stripping -O
The tool needs to run the preprocessor (but does not actually produce compiled outputs), and meanwhile ignores lots of flags it doesn't think it needs. In the case of -D_FORTIFY_SOURCE=... this is only valid if -O is there too, but otherwise spits out confusing warnings. The warnings are spurious and can be safely ignored, but in this case let's go the extra mile and fix g-ir-scanner's upstream bug by removing the fortify flag first. Fixes #9161
-rw-r--r--mesonbuild/modules/gnome.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index a2f98bc..d148f45 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -817,7 +817,9 @@ class GnomeModule(ExtensionModule):
def _get_scanner_cflags(cflags):
'g-ir-scanner only accepts -I/-D/-U; must ignore all other flags'
for f in cflags:
- if f.startswith(('-D', '-U', '-I')):
+ # _FORTIFY_SOURCE depends on / works together with -O, on the other hand this
+ # just invokes the preprocessor anyway
+ if f.startswith(('-D', '-U', '-I')) and not f.startswith('-D_FORTIFY_SOURCE'):
yield f
@staticmethod