[cfe-commits] r76821 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.h lib/Sema/SemaDecl.cpp test/Sema/return.c test/SemaCXX/return.cpp test/SemaObjC/return.m

Fariborz Jahanian fjahanian at apple.com
Wed Jul 22 17:48:45 PDT 2009


On Jul 22, 2009, at 4:56 PM, Mike Stump wrote:

> Author: mrs
> Date: Wed Jul 22 18:56:57 2009
> New Revision: 76821
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76821&view=rev
> Log:
> Add warning for falling off the end of a function that should return a
> value.  This is on by default, and controlled by -Wreturn-type (-Wmost
> -Wall).  I believe there should be very few false positives, though
> the most interesting case would be:
>
>  int() { bar(); }
>
> when bar does:
>
>  bar() { while (1) ; }
>
> Here, we assume functions return, unless they are marked with the
> noreturn attribute.  I can envision a fixit note for functions that
> never return normally that don't have a noreturn attribute to add a
> noreturn attribute.


Do you detect more common  cases of:

int foo () { exit(0); }

- fariborz




More information about the cfe-commits mailing list