[cfe-dev] -Wreturn-type regression

Dmitri Gribenko gribozavr at gmail.com
Thu Mar 6 05:21:50 PST 2014


On Thu, Mar 6, 2014 at 10: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.

Ted, this might be interesting for you since you have been doing
changes in this area recently.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/




More information about the cfe-dev mailing list