diff options
author | Kenneth Graunke <[email protected]> | 2018-01-30 01:32:07 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-10-19 10:16:57 -0700 |
commit | f91f9bab83dd87034acc520d51d2f9f84984cec6 (patch) | |
tree | 6ad775963e9b44c0c5c9e4b214cac42c9dd07397 /meson.build | |
parent | 0d380af8097cf85122596041af1a611a8139de18 (diff) |
meson: Add -Werror=return-type when supported.
This warning detects non-void functions with a missing return statement,
return statements with a value in void functions, and functions with an
bogus return type that ends up defaulting to int. It's already enabled
by default with -Wall. Generally, these are fairly serious bugs in the
code, which developers would like to notice and fix immediately. This
patch promotes it from a warning to an error, to help developers catch
such mistakes early.
I would not expect this warning to change much based on the compiler
version, so hopefully it won't become a problem for packagers/builders.
See the GCC documentation or 'man gcc' for more details:
https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/Warning-Options.html#index-Wreturn-type
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 505cc6c79bd..0dfe09858bf 100644 --- a/meson.build +++ b/meson.build @@ -788,7 +788,8 @@ endif # Check for generic C arguments c_args = [] foreach a : ['-Wall', '-Werror=implicit-function-declaration', - '-Werror=missing-prototypes', '-fno-math-errno', + '-Werror=missing-prototypes', '-Werror=return-type', + '-fno-math-errno', '-fno-trapping-math', '-Qunused-arguments'] if cc.has_argument(a) c_args += a @@ -808,7 +809,8 @@ endif # Check for generic C++ arguments cpp_args = [] -foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math', +foreach a : ['-Wall', '-Werror=return-type', + '-fno-math-errno', '-fno-trapping-math', '-Qunused-arguments'] if cpp.has_argument(a) cpp_args += a |