diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-09-01 12:25:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 22:25:32 +0300 |
commit | 9bf669a016005867e6307f6624f3a130a6a86a1a (patch) | |
tree | 8cea3c32b07619a8f6209cc2d175d97e7f9160df /mesonbuild/compilers/compilers.py | |
parent | 43302d3296baff6aeaf8e03f5d701b0402e37a6c (diff) | |
download | meson-9bf669a016005867e6307f6624f3a130a6a86a1a.zip meson-9bf669a016005867e6307f6624f3a130a6a86a1a.tar.gz meson-9bf669a016005867e6307f6624f3a130a6a86a1a.tar.bz2 |
Clang should error for all implicit function checks (#9165)
* compilers: improve docstring to `get_compiler_check_args()`
There was an incomplete list, which wasn't useful as it now takes an
enum anyway. Also add a new entry to the list of reasons to use this
function.
* clang: Add -Werror=implicit-function-declarations to check_args
Unlike GCC, clang warns but doesn't error when an implicit function
declaration happens. This means in checks like
`compiler.has_header_symbol('string.h', 'strlcat')` (on Linux, at least)
that GCC will fail, as there is no such function; clang will emit a
warning, but since it exists with a 0 status Meson interprets that as
success. To fix this, add `-Werror=implicit-function-declarations` to
clang's check arguments.
There seems to be something specific about functions that _may_ exist in
a header on a given system, as `cc.has_header_symbol('string.h',
'foobar')` will return false with clang, but `strlcat` will return true,
even though it's not defined. It is however, defined in some OSes, like
Solaris and the BSDs.
Fixes #9140
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index e23d18e..ed77df6 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1154,11 +1154,12 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]: """Arguments to pass the compiler and/or linker for checks. - The default implementation turns off optimizations. mode should be - one of: + The default implementation turns off optimizations. Examples of things that go here: - extra arguments for error checking + - Arguments required to make the compiler exit with a non-zero status + when something is wrong. """ return self.get_no_optimization_args() |