[cfe-dev] -Wreturn-type regression

İsmail Dönmez ismail at donmez.ws
Thu Mar 6 02:32:44 PST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140306/79bc579d/attachment.html>


More information about the cfe-dev mailing list