summaryrefslogtreecommitdiff
path: root/stdio-common/tst-sprintf.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-12-11 13:46:21 -0800
committerRoland McGrath <roland@hack.frob.com>2014-12-11 13:47:44 -0800
commit1c4053db63e2a3470ed8ace2ddd9636f9a6e135c (patch)
tree9ea23fa846a90b210e9d9447f08f390153f4132b /stdio-common/tst-sprintf.c
parenta1edbf3cb8095699794d6601446c0f18cfa265a8 (diff)
downloadglibc-1c4053db63e2a3470ed8ace2ddd9636f9a6e135c.tar.gz
Eliminate -Wno-format from printf/scanf tests.
Diffstat (limited to 'stdio-common/tst-sprintf.c')
-rw-r--r--stdio-common/tst-sprintf.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
index 2fe373f350..ea3008b68b 100644
--- a/stdio-common/tst-sprintf.c
+++ b/stdio-common/tst-sprintf.c
@@ -45,15 +45,26 @@ do_test (void)
result = 1;
}
- if (sprintf (buf, "%67108863.16\"%d", 7) != 14
- || strcmp (buf, "%67108863.16\"7") != 0)
+ /* We are testing a corner case of the sprintf format string here. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
+ int n = sprintf (buf, "%67108863.16\"%d", 7);
+ DIAG_POP_NEEDS_COMMENT;
+
+ if (n != 14 || strcmp (buf, "%67108863.16\"7") != 0)
{
- printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output", buf);
+ printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output",
+ buf);
result = 1;
}
- if (sprintf (buf, "%*\"%d", 0x3ffffff, 7) != 11
- || strcmp (buf, "%67108863\"7") != 0)
+ /* We are testing a corner case of the sprintf format string here. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
+ n = sprintf (buf, "%*\"%d", 0x3ffffff, 7);
+ DIAG_POP_NEEDS_COMMENT;
+
+ if (n != 11 || strcmp (buf, "%67108863\"7") != 0)
{
printf ("sprintf (buf, \"%%*\\\"%%d\", 0x3ffffff, 7) produced `%s' output", buf);
result = 1;