[Mesa-dev] [PATCH v2] meson: Add -Werror=return-type when supported.

Kenneth Graunke kenneth at whitecape.org
Fri Oct 19 17:57:28 UTC 2018


On Friday, October 19, 2018 10:17:29 AM PDT Matt Turner wrote:
> On Thu, Oct 18, 2018 at 6:06 PM Kenneth Graunke <kenneth at whitecape.org> 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.
> >
> > 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
> 
> I'm curious what prompted this. Did we actually have a bug that would
> have been caught by this?
> 

Never committed, but I broke some things in iris a long while back.
I think I had botched includes which made some type not exist, which
made it default to an int type, which wasn't at all what I wanted.

I think it may have been something that led to GPU hangs or something
awful.  Spent a while debugging it, then asked "why doesn't the
compiler just disallow this?".  At the time I still had a fair amount
of warnings about unused things I hadn't finished hooking up, so I
missed the warning.

Hmm, but now I guess you have to patch this out for Gentoo by policy?
I'm adamantly against -Werror, but I figured this very narrow subset
could be useful while not breaking unless there are real bugs.

If people really don't want it, feel free to revert.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181019/3c31822c/attachment.sig>


More information about the mesa-dev mailing list