Issue 83813
Summary Clang reports [-Wmissing-noreturn] warning only for functions with void return type.
Labels clang
Assignees
Reporter mushenoy
    Clang reports ```-Wmissing-noreturn``` warning only for functions with void return type. 
It doesnt seem to report the warning for functions with non-void return type.

GCC reports the warnings for both type of functions.

Sample program:
void_prog.c:
```
#include <stdlib.h>

void test ()
{
    abort(); ;
    return;
}
```

int_prog.c:
```
#include <stdlib.h>

int test ()
{
    abort(); ;
    return 0;
}
```

Compilation with Clang:
```
# clang -c -Wmissing-noreturn void_prog.c
void_prog.c:4:1: warning: function 'test' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
1 warning generated.

# clang -c -Wmissing-noreturn int_prog.c
#
```

Compilation with GCC:
```
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to