This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix warning from latest GCC in tst-printf.c
- From: Steve Ellcey <sellcey at caviumnetworks dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 1 Nov 2016 15:29:04 -0700
- Subject: Re: [PATCH] Fix warning from latest GCC in tst-printf.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- References: <1477003405.8523.21.camel@caviumnetworks.com> <1478020891.2891.45.camel@caviumnetworks.com> <alpine.DEB.2.20.1611011736580.21300@digraph.polyomino.org.uk>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Tue, 2016-11-01 at 17:37 +0000, Joseph Myers wrote:
> On Tue, 1 Nov 2016, Steve Ellcey wrote:
>
> >
> > Ping. One of the snprintf statements in this test is using a %.999999u
> > format so it is obvious that the test wants to test formats that would
> > go beyond the limit of the snprintf buffer and so we should ignore the
> > warnings in this test.
> OK provided you've tested that this change works with older GCC that lack
> the new option (otherwise it would need to be conditional on the GCC
> version).
I did forget to check it with an older GCC and it does fail with GCC
5.4. Here is a new version with a conditional. Tested with GCC 5.4
and GCC 7.0 (prerelease).
Ok to checkin?
Steve Ellcey
sellcey@caviumnetworks.com
2016-11-01 Steve Ellcey <sellcey@caviumnetworks.com>
* stdio-common/tst-printf.c: Ignore -Wformat-length warning.
diff --git a/stdio-common/tst-printf.c b/stdio-common/tst-printf.c
index 2896b18..ffe7ac7 100644
--- a/stdio-common/tst-printf.c
+++ b/stdio-common/tst-printf.c
@@ -32,6 +32,11 @@
The compiler warnings are not useful here. */
DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
+#if __GNUC_PREREQ (7, 0)
+/* Compiler warnings about format lengths should also be ignored. */
+DIAG_IGNORE_NEEDS_COMMENT (7.0, "-Wformat-length");
+#endif
+
static void rfg1 (void);
static void rfg2 (void);
static void rfg3 (void);