C++: Test case for cpp/wrong-number-format-arguments

This commit is contained in:
Calum Grant
2024-12-03 16:33:40 +00:00
parent cc4382c785
commit 08859be07b
2 changed files with 6 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
| macros.cpp:14:2:14:37 | call to printf | Format for printf (in a macro expansion) expects 4 arguments but given 3 |
| macros.cpp:21:2:21:36 | call to printf | Format for printf (in a macro expansion) expects 4 arguments but given 3 |
| macros.cpp:32:2:32:25 | call to printf | Format for printf (in a macro expansion) expects 1 arguments but given 0 |
| syntax_errors.c:8:5:8:10 | call to printf | Format for printf expects 2 arguments but given 1 |
| test.c:9:2:9:7 | call to printf | Format for printf expects 1 arguments but given 0 |
| test.c:12:2:12:7 | call to printf | Format for printf expects 2 arguments but given 1 |
| test.c:15:2:15:7 | call to printf | Format for printf expects 3 arguments but given 2 |

View File

@@ -3,5 +3,9 @@
extern int printf(const char *fmt, ...);
void test_syntax_error() {
printf("Error code %d: " FMT_MSG, 0, "");
printf("Error code %d: " UNDEFINED_MACRO, 0, "");
printf("%d%d",
(UNDEFINED_MACRO)1,
(UNDEFINED_MACRO)2);
}