mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C++: Add more noreturn attribute tests
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
| test.c:8:5:8:14 | declaration | Function f2 should return a value of type int but does not return a value here |
|
||||
| test.c:25:9:25:14 | ExprStmt | Function f4 should return a value of type int but does not return a value here |
|
||||
| test.c:39:9:39:14 | ExprStmt | Function f6 should return a value of type int but does not return a value here |
|
||||
| test.c:117:5:117:10 | ExprStmt | Function f19 should return a value of type int but does not return a value here |
|
||||
| test.c:123:5:123:10 | ExprStmt | Function f21 should return a value of type int but does not return a value here |
|
||||
| test.c:135:5:135:10 | ExprStmt | Function f25 should return a value of type int but does not return a value here |
|
||||
| test.cpp:16:1:18:1 | { ... } | Function g2 should return a value of type MyValue but does not return a value here |
|
||||
| test.cpp:52:1:52:1 | return ... | Function g7 should return a value of type MyValue but does not return a value here |
|
||||
| test.cpp:74:1:76:1 | { ... } | Function g10 should return a value of type second but does not return a value here |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// semmle-extractor-options: -std=c11
|
||||
// semmle-extractor-options: -std=c23
|
||||
int f1(void) {
|
||||
int x = 1;
|
||||
return 2;
|
||||
@@ -110,3 +110,27 @@ int f17() {
|
||||
if (__builtin_expect(1, 0))
|
||||
__builtin_unreachable(); // GOOD
|
||||
}
|
||||
|
||||
[[_Noreturn]] void f18();
|
||||
|
||||
int f19() {
|
||||
f18(); // GOOD
|
||||
}
|
||||
|
||||
[[___Noreturn__]] void f20();
|
||||
|
||||
int f21() {
|
||||
f20(); // GOOD
|
||||
}
|
||||
|
||||
[[noreturn]] void f22();
|
||||
|
||||
int f23() {
|
||||
f22(); // GOOD
|
||||
}
|
||||
|
||||
[[___noreturn__]] void f24();
|
||||
|
||||
int f25() {
|
||||
f24(); // GOOD
|
||||
}
|
||||
|
||||
@@ -188,3 +188,10 @@ int g22() {
|
||||
int g23() {
|
||||
Aborting().a(); // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
|
||||
[[__noreturn__]]
|
||||
int g24();
|
||||
|
||||
int g25() {
|
||||
g24(); // GOOD
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user