[Mesa-dev] [PATCH mesa] meson: merge C and C++ compiler arguments check
Eric Engestrom
eric.engestrom at imgtec.com
Mon Mar 12 15:01:42 UTC 2018
Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
Dylan, was there any reason to have -Werror=missing-prototypes and
-Werror=implicit-function-declaration in C but not C++?
Both sound to me like something we always want.
---
meson.build | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/meson.build b/meson.build
index b9f7cd2aff5fc49e0d93..6a4d2aded7c72bbb1029 100644
--- a/meson.build
+++ b/meson.build
@@ -766,7 +766,9 @@ if ['linux', 'cygwin'].contains(host_machine.system())
pre_args += '-D_GNU_SOURCE'
endif
-# Check for generic C arguments
+# Check for generic C/C++ arguments
+cpp = meson.get_compiler('cpp')
+cpp_args = []
c_args = []
foreach a : ['-Wall', '-Werror=implicit-function-declaration',
'-Werror=missing-prototypes', '-fno-math-errno',
@@ -774,22 +776,15 @@ foreach a : ['-Wall', '-Werror=implicit-function-declaration',
if cc.has_argument(a)
c_args += a
endif
+ if cpp.has_argument(a)
+ cpp_args += a
+ endif
endforeach
c_vis_args = []
if cc.has_argument('-fvisibility=hidden')
c_vis_args += '-fvisibility=hidden'
endif
-# Check for generic C++ arguments
-cpp = meson.get_compiler('cpp')
-cpp_args = []
-foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
- '-Qunused-arguments']
- if cpp.has_argument(a)
- cpp_args += a
- endif
-endforeach
-
# For some reason, the test for -Wno-foo always succeeds with gcc, even if the
# option is not supported. Hence, check for -Wfoo instead.
if cpp.has_argument('-Wnon-virtual-dtor')
--
Cheers,
Eric
More information about the mesa-dev
mailing list