Skip to content

Commit bd40d24

Browse files
committed
C++: Support more "noreturn" attributes in DefaultOptions
1 parent f4f5f28 commit bd40d24

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

cpp/ql/lib/DefaultOptions.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class Options extends string {
5454
*
5555
* By default, this holds for `exit`, `_exit`, `_Exit`, `abort`,
5656
* `__assert_fail`, `longjmp`, `__builtin_unreachable` and any
57-
* function with a `noreturn` or `__noreturn__` attribute or
58-
* `noreturn` specifier.
57+
* function with a `noreturn`, `__noreturn__`, `_Noreturn`, or
58+
* `_noreturn` attribute or `noreturn` specifier.
5959
*/
6060
predicate exits(Function f) {
61-
f.getAnAttribute().hasName(["noreturn", "__noreturn__"])
61+
f.getAnAttribute().hasName(["noreturn", "__noreturn__", "_Noreturn", "_noreturn"])
6262
or
6363
f.getASpecifier().hasName("noreturn")
6464
or

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
| test.c:8:5:8:14 | declaration | Function f2 should return a value of type int but does not return a value here |
44
| test.c:25:9:25:14 | ExprStmt | Function f4 should return a value of type int but does not return a value here |
55
| test.c:39:9:39:14 | ExprStmt | Function f6 should return a value of type int but does not return a value here |
6-
| test.c:117:5:117:10 | ExprStmt | Function f19 should return a value of type int but does not return a value here |
7-
| test.c:123:5:123:10 | ExprStmt | Function f21 should return a value of type int but does not return a value here |
8-
| test.c:135:5:135:10 | ExprStmt | Function f25 should return a value of type int but does not return a value here |
96
| test.cpp:16:1:18:1 | { ... } | Function g2 should return a value of type MyValue but does not return a value here |
107
| test.cpp:52:1:52:1 | return ... | Function g7 should return a value of type MyValue but does not return a value here |
118
| test.cpp:74:1:76:1 | { ... } | Function g10 should return a value of type second but does not return a value here |

0 commit comments

Comments
 (0)