Skip to content

Commit a55c2fb

Browse files
committed
Revert "Merge pull request github#17906 from github/calumgrant/bmn/wrong-number-format-args"
This reverts commit 39b2d2c, reversing changes made to a35a4b2.
1 parent c65ce97 commit a55c2fb

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

cpp/ql/src/Likely Bugs/Format/WrongNumberOfFormatArguments.ql

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616

1717
import cpp
1818

19-
class SyntaxError extends CompilerError {
20-
SyntaxError() { this.getTag().matches("exp_%") }
21-
22-
predicate affects(Element e) {
23-
exists(Location l1, Location l2 |
24-
l1 = this.getLocation() and
25-
l2 = e.getLocation()
26-
|
27-
l1.getFile() = l2.getFile() and
28-
l1.getStartLine() = l2.getStartLine()
29-
)
30-
}
31-
}
32-
3319
from FormatLiteral fl, FormattingFunctionCall ffc, int expected, int given, string ffcName
3420
where
3521
ffc = fl.getUse() and
@@ -41,10 +27,7 @@ where
4127
if ffc.isInMacroExpansion()
4228
then ffcName = ffc.getTarget().getName() + " (in a macro expansion)"
4329
else ffcName = ffc.getTarget().getName()
44-
) and
45-
// A typical problem is that string literals are concatenated, but if one of the string
46-
// literals is an undefined macro, then this just leads to a syntax error.
47-
not exists(SyntaxError e | e.affects(fl))
30+
)
4831
select ffc,
4932
"Format for " + ffcName + " expects " + expected.toString() + " arguments but given " +
5033
given.toString()

cpp/ql/test/query-tests/Likely Bugs/Format/WrongNumberOfFormatArguments/syntax_errors.c

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)