[cfe-dev] -Wreturn-type regression

Ted Kremenek kremenek at apple.com
Thu Mar 6 14:49:26 PST 2014


Please file a PR and I’ll take a look.

On Mar 6, 2014, at 2:32 AM, İsmail Dönmez <ismail at donmez.ws> wrote:

> Hi,
> 
> Given the following code
> 
> #include <stdlib.h>
> 
> #define av_assert0(cond) do {                                           \
>     if (!(cond)) {                                                      \
>         abort();                                                        \
>     }                                                                   \
> } while (0)
> 
> int f(int x) {
>     switch(x) {
>         case 0:
>             return 0;
>         default:
>             av_assert0(0);
>     }
> }
> 
> int main()
> {
> }
> 
> [/havana/t]> clang --version
> clang version 3.4 (branches/release_34 198681)
> Target: x86_64-suse-linux
> Thread model: posix
> [/havana/t]> clang -Wall -Wreturn-type t.c
> [/havana/t]> 
> 
> No warnings. With recent trunk:
> 
> [/havana/t]> clang -v 
> clang version 3.5.0 (trunk 202995)
> [/havana/t]> clang -Wall -Wreturn-type t.c
> t.c:16:1: warning: control may reach end of non-void function [-Wreturn-type]
> }
> ^
> 1 warning generated.
> 
> So looks like clang is no longer recognizing abort being a __noreturn__ function.
> 
> Regards,
> ismail
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list