Skip to content

Commit

Permalink
C++: Support more "noreturn" attributes in DefaultOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jketema committed Jan 16, 2025
1 parent f4f5f28 commit bd40d24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cpp/ql/lib/DefaultOptions.qll
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class Options extends string {
*
* By default, this holds for `exit`, `_exit`, `_Exit`, `abort`,
* `__assert_fail`, `longjmp`, `__builtin_unreachable` and any
* function with a `noreturn` or `__noreturn__` attribute or
* `noreturn` specifier.
* function with a `noreturn`, `__noreturn__`, `_Noreturn`, or
* `_noreturn` attribute or `noreturn` specifier.
*/
predicate exits(Function f) {
f.getAnAttribute().hasName(["noreturn", "__noreturn__"])
f.getAnAttribute().hasName(["noreturn", "__noreturn__", "_Noreturn", "_noreturn"])
or
f.getASpecifier().hasName("noreturn")
or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
| 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 |
Expand Down

0 comments on commit bd40d24

Please sign in to comment.