Skip to content

Commit

Permalink
gnome: don't let fortify defines into the g-ir-scanner after strippin…
Browse files Browse the repository at this point in the history
…g -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 mesonbuild#9161
  • Loading branch information
eli-schwartz authored and xclaesse committed Aug 24, 2021
1 parent b3c2409 commit 1dce556
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mesonbuild/modules/gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,9 @@ def _get_external_args_for_langs(self, state, langs):
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
Expand Down

0 comments on commit 1dce556

Please sign in to comment.