Skip to content

Commit 312e622

Browse files
authored
Merge pull request github#3330 from MathiasVP/libc-assert
C++: Generalize charpred of LibcAssert
2 parents 54d1991 + 1016a0c commit 312e622

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp/ql/src/semmle/code/cpp/commons/Assertions.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ abstract class Assertion extends Locatable {
1212
}
1313

1414
/**
15-
* A libc assert, as defined in assert.h. A macro with the head
16-
* "assert(expr)" that expands to a conditional expression which
17-
* may terminate the program.
15+
* A libc assert, as defined in assert.h. A macro with a head
16+
* that matches the prefix "assert(", and expands to a conditional
17+
* expression which may terminate the program.
1818
*/
1919
class LibcAssert extends MacroInvocation, Assertion {
20-
LibcAssert() { this.getMacro().getHead() = "assert(expr)" }
20+
LibcAssert() { this.getMacro().getHead().matches("assert(%") }
2121

2222
override Expr getAsserted() {
2323
exists(ConditionalExpr ce | this.getAGeneratedElement() = ce | result = ce.getCondition())

0 commit comments

Comments
 (0)