On Monday, 2018-10-15 18:53:40 -0700, Kenneth Graunke wrote:
> 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.

Agreed.

> 
> 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.

That's always my worry when adding `-Werror`s, but I think you're right.

> 
> 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
> ---
>  meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 002ce35a608..11e0ea2c08e 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',

I think we should add this to C++ code as well (~20 lines below).

With C++ getting the same treatment:
Reviewed-by: Eric Engestrom <eric.engest...@intel.com>

(btw, we might want to add the same to configure.ac, but I'm not sure
(m)any devs still use it, I think it's mostly just old deployment/testing
systems, and packagers for some of the slow distros, so not the people
who would introduce these issues in the first place)

>               '-fno-trapping-math', '-Qunused-arguments']
>    if cc.has_argument(a)
>      c_args += a
> -- 
> 2.19.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to