From patchwork Thu Dec 11 21:55:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 4202 Received: (qmail 18379 invoked by alias); 11 Dec 2014 21:56:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 18288 invoked by uid 89); 11 Dec 2014 21:56:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Suppress -Wformat-security in tst-error1.c. Message-Id: <20141211215558.C4A002C3B01@topped-with-meat.com> Date: Thu, 11 Dec 2014 13:55:58 -0800 (PST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=6d6xT9GhkXpMmJvlA9gA:9 a=CjuIK1q_8ugA:10 Because the test has no comments, it was not clear to me if it was specifically testing large format strings or just large output. If only the latter, then using a "%s" format would be the better fix. But this fixes the build without changing what the test tests. With this, I have no more build errors in 'make check' for x86_64-linux-gnu using the Ubuntu 14.04 gcc-4.8.2 that breaks command-line -Wno-format. Thanks, Roland * misc/tst-error1.c (do_test): Ignore -Wformat-security for generated error format strings. --- a/misc/tst-error1.c +++ b/misc/tst-error1.c @@ -3,6 +3,7 @@ #include #include #include +#include static int do_test (int argc, char *argv[]) @@ -16,8 +17,18 @@ do_test (int argc, char *argv[]) for (int i = 0; i < 1000; ++i) memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str)); error (0, 0, str); + + /* We're testing a large format string here and need to generate it + to avoid this source file being ridiculous. So disable the warning + about a generated format string. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-security"); + error (0, 0, buf); error (0, 0, buf); + + DIAG_POP_NEEDS_COMMENT; + error (0, 0, str); return 0; }