diff options
author | Sam James <sam@gentoo.org> | 2024-06-03 09:43:20 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-06-24 00:36:06 +0100 |
commit | 4ad792e158b6059eb847dd0562aff9bd7029981f (patch) | |
tree | 66a0ccd94a98788e229737fce4c71a3a8c60b982 /mesonbuild/compilers/asm.py | |
parent | b56a3198b4e8e8a6738dc372bddc66225abc20f9 (diff) | |
download | meson-4ad792e158b6059eb847dd0562aff9bd7029981f.zip meson-4ad792e158b6059eb847dd0562aff9bd7029981f.tar.gz meson-4ad792e158b6059eb847dd0562aff9bd7029981f.tar.bz2 |
compilers: detect: fix pre-processor scraping by defining language
_get_gnu_compiler_defines and _get_clang_compiler_defines were broken
by not defining the language they used.
Neither GCC nor Clang infer the language based on the driver name which means
`self.defines` isn't populated correctly in compilers/cpp.py.
e.g.
```
$ echo "" | g++ -E -dM - | grep -i cplus
$ echo "" | g++ -x c++ -E -dM - | grep -i cplus
#define __cplusplus 201703L
```
Fix that by passing '-cpp -x LANGUAGE' as a first pass. If it fails, try
again without '-cpp -x LANGUAGE' as before, as its portability isn't
certain. We do '-cpp' because during testing, I found Fortran needs this,
although per below, I had to drop Fortran in the end and leave it to the
fallback (existing) path.
Without this change, a63739d394dd77314270f5a46f79171a8c544e77 is only
partially effective. It works if the system has injected Clang options
via /etc/clang configuration files, but not by e.g. patching the driver
(or for GCC there too).
Unfortunately, we have to wimp out for Fortran and fallback to the
old method because you need the language standard (e.g. -x f95).
Diffstat (limited to 'mesonbuild/compilers/asm.py')
0 files changed, 0 insertions, 0 deletions