From ec5007364487da64545f383b5725ed5074109050 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Wed, 24 Jan 2018 22:18:12 +0800 Subject: Print warning when linker arguments are passed to has_argument has_argument and other similar methods of compiler objects only support checking compiler flags. If they are used to check linker flags, the results are very likely to be wrong and developers should be warned. --- mesonbuild/compilers/c.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mesonbuild/compilers/c.py') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 4c6e3a2..5b376e9 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -804,6 +804,13 @@ class CCompiler(Compiler): return ['-pthread'] def has_multi_arguments(self, args, env): + for arg in args: + if arg.startswith('-Wl,'): + mlog.warning('''{} looks like a linker argument, but has_argument +and other similar methods only support checking compiler arguments. +Using them to check linker arguments are never supported, and results +are likely to be wrong regardless of the compiler you are using. +'''.format(arg)) return self.compiles('int i;\n', env, extra_args=args) -- cgit v1.1