Skip to content

Commit 496efee

Browse files
committed
C++: Add a test for cpp/wrong-number-format-arguments
1 parent 7418d8e commit 496efee

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| macros.cpp:14:2:14:37 | call to printf | Format for printf (in a macro expansion) expects 4 arguments but given 3 |
66
| macros.cpp:21:2:21:36 | call to printf | Format for printf (in a macro expansion) expects 4 arguments but given 3 |
77
| macros.cpp:32:2:32:25 | call to printf | Format for printf (in a macro expansion) expects 1 arguments but given 0 |
8+
| syntax_errors.c:6:5:6:10 | call to printf | Format for printf expects 1 arguments but given 0 |
89
| test.c:9:2:9:7 | call to printf | Format for printf expects 1 arguments but given 0 |
910
| test.c:12:2:12:7 | call to printf | Format for printf expects 2 arguments but given 1 |
1011
| test.c:15:2:15:7 | call to printf | Format for printf expects 3 arguments but given 2 |
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// semmle-extractor-options: --expect_errors
2+
3+
extern int printf(const char *fmt, ...);
4+
5+
void test_syntax_error() {
6+
printf("Error code %d: " FMT_MSG, 0, "");
7+
}

0 commit comments

Comments
 (0)