aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/scanf4.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/scanf4.c')
-rw-r--r--stdio-common/scanf4.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stdio-common/scanf4.c b/stdio-common/scanf4.c
index f9a9134745..9bb14bb16b 100644
--- a/stdio-common/scanf4.c
+++ b/stdio-common/scanf4.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libc-internal.h>
int
main(int arc, char *argv[])
@@ -15,7 +16,14 @@ main(int arc, char *argv[])
printf("Result of fscanf %%n = %d\n", res);
printf("Scanned format = %d\n", val);
+ /* We're testing exactly the case the warning is for. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-zero-length");
+
res = fscanf(fp, "");
+
+ DIAG_POP_NEEDS_COMMENT;
+
printf("Result of fscanf \"\" = %d\n", res);
if (res != 0)
abort ();