RFR: 8062808: Turn on the -Wreturn-type warning

Stefan Karlsson stefan.karlsson at oracle.com
Wed Nov 5 21:48:15 UTC 2014


On 2014-11-05 22:40, Kim Barrett wrote:
> On Nov 5, 2014, at 2:56 PM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
>> I understand, but that's what you'll find if you look at the shared code. I only added a few more places, where our other compilers didn't complain about this or the code wasn't compiled with those compilers. With that said, I'm all for cleaning this up, but it's a pretty large undertaking that I don't think should prevent the usage of -Wreturn-type.
> Ugh.  I suppose that’s true, in which case I agree that adding a couple more isn’t doing much harm, and turning on the warning is a significant benefit.
>
>>> I know that gcc/clang/MS all have annotation mechanism to mark code unreachable or functions as no-return.
>> My first implementation of thisused notreturn annotations on gcc/clang/MS, but since we need to support other compilers that don't have this annotation we can't really take advantage of the annotation to fix this problem throughout our code base. We would still have all these constructs that you've pointed out, except for the two I added.
> Do compilers without such annotations also issue such warnings?

I couldn't find one for the Sun Studio compiler. Maybe someone else knows?
>
>> I've asked around and I've heard of a hand-full of HotSpot developers that has been bitten by this. :)
> I’m used to building with -Wall -Werror (from my previous job, and something I pushed for), and am discovering that I’ve become more reliant on the compiler telling me I’m doing something stupid than I had realized.
>
Yes.

StefanK


More information about the hotspot-dev mailing list