RFR: 8062808: Turn on the -Wreturn-type warning
Thomas Schatzl
thomas.schatzl at oracle.com
Wed Nov 5 21:53:06 UTC 2014
Hi,
On Wed, 2014-11-05 at 22:48 +0100, Stefan Karlsson wrote:
> 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?
> >
At least since Sun studio 11 there is the "#pragma does_not_return".
http://docs.oracle.com/cd/E19422-01/819-3690-10/819-3690-10.pdf
and later (12+) even add a "noreturn" attribute for compatibility.
http://docs.oracle.com/cd/E24457_01/html/E21991/gljol.html
Thanks,
Thomas
More information about the hotspot-dev
mailing list