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: 420258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EE0D014009B for ; Fri, 12 Dec 2014 08:56:08 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=KWhxW0R/1Cd0Tmdv1vNoKP2mQCOVXD/LJomTPy0eVYb7ee 3veerD5AAa5xFadu/mzkwPjVnKpp+z5pQCqfDTqu/bY359AtsbZpCrVv9/cMnjn8 xcRyhEb6vV1ZhCCOd9frk+4/NUIgn7CeMMJYC/9BhYKsWCer0B7gZ2tX6r91s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=H7pslfV4w8h4MNLwvn/xmJ4a0LY=; b=gQ4//DH461IS2Gg7bGer LBMve7xpqu0CGTe7Eg3nDQB+5tIKvlvLc3LQqvRsfd4lwjTFa0o4odjya6Wyd2gt 2roYKrptImy9cMYjgJO4mdezcq9MQQJDujvWTkSpVXrhfo3vxII0r5QUkT7mE2zZ aomXOB1zDurAots6o3C5anI= 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; }