From patchwork Fri Feb 27 14:13:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 444295 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 2372714007D for ; Sat, 28 Feb 2015 01:14:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=R1FsOWDD; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=yh7pmEU0QgD6q97qEtE6uIDeyKwULCX3oesLiCi5dZpFo96gbtmNN pH3MN3H3pf8xwqg17CggehyjUKCPSdbrY9WyrH6ikUyNw/pZmVOtN5WOoc+0nU47 I3IraxBA0lXASN8iMXDrTuUZ2Xd4wjF1vdlLM1aAsyNjc6gpskMCeM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=uH8qI7Ol0/TXBVxmklzd3fA2QBs=; b=R1FsOWDDPO0E8ZN+hTuS hLdW2sT4AFdsbd1upv0PS9G4KdHqqGu9njvtGSVXfNYLtCNmdyHX2+XBkYA7yH/m 5moHeJFnrr0lq7f6x8iKyJMdjsNGYTvJy0FVl5b1+dS64SXmPiBTcGty3LR3tft9 TBu5BNXoOu99ezWRoDsL7GA= Received: (qmail 89113 invoked by alias); 27 Feb 2015 14:13:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 89035 invoked by uid 89); 27 Feb 2015 14:13:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 27 Feb 2015 14:13:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1REDm18032647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 27 Feb 2015 09:13:48 -0500 Received: from redhat.com ([10.40.204.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1REDjQZ016957 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 27 Feb 2015 09:13:47 -0500 Date: Fri, 27 Feb 2015 15:13:44 +0100 From: Marek Polacek To: GCC Patches Subject: [committed] Move -Wformat-signedness out of -Wformat=2 (PR c/65040) Message-ID: <20150227141344.GL22272@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Many folks complained that -Wformat-signedness is overly pedantic, and especially with -Werror it can cause a lot of needless pain. This patch moves it ouf of -Wformat=2. Bootstrapped/regtested on x86_64-linux, applying to trunk. 2015-02-27 Marek Polacek PR c/65040 * doc/invoke.texi: Update to reflect that -Wformat=2 doesn't enable -Wformat-signedness anymore. * c.opt (Wformat-signedness): Don't enable by -Wformat=2. * gcc.dg/pr65066.c: Use -Wformat -Wformat-signedness and not -Wformat=2. Marek diff --git gcc/c-family/c.opt gcc/c-family/c.opt index fd00407..b3c8cee 100644 --- gcc/c-family/c.opt +++ gcc/c-family/c.opt @@ -456,7 +456,7 @@ C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ Obj Warn about possible security problems with format functions Wformat-signedness -C ObjC C++ ObjC++ Var(warn_format_signedness) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) +C ObjC C++ ObjC++ Var(warn_format_signedness) Warning Warn about sign differences with format functions Wformat-y2k diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index ef4cc75..b07eed0 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -3631,7 +3631,7 @@ The C standard specifies that zero-length formats are allowed. @opindex Wformat=2 Enable @option{-Wformat} plus additional format checks. Currently equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security --Wformat-signedness -Wformat-y2k}. +-Wformat-y2k}. @item -Wformat-nonliteral @opindex Wformat-nonliteral diff --git gcc/testsuite/gcc.dg/pr65066.c gcc/testsuite/gcc.dg/pr65066.c index 883a87d..291e97a 100644 --- gcc/testsuite/gcc.dg/pr65066.c +++ gcc/testsuite/gcc.dg/pr65066.c @@ -1,6 +1,6 @@ /* PR c/65066 */ /* { dg-do compile } */ -/* { dg-options "-Wformat=2" } */ +/* { dg-options "-Wformat -Wformat-signedness" } */ extern int sscanf (const char *restrict, const char *restrict, ...); int *a;