From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7410 invoked by alias); 23 Oct 2012 19:25:45 -0000 Received: (qmail 7398 invoked by uid 22791); 23 Oct 2012 19:25:41 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vb0-f47.google.com (HELO mail-vb0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Oct 2012 19:25:33 +0000 Received: by mail-vb0-f47.google.com with SMTP id ez10so4833237vbb.20 for ; Tue, 23 Oct 2012 12:25:32 -0700 (PDT) Received: by 10.52.71.9 with SMTP id q9mr18486162vdu.36.1351020331950; Tue, 23 Oct 2012 12:25:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.204.12 with HTTP; Tue, 23 Oct 2012 12:25:11 -0700 (PDT) In-Reply-To: References: From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Tue, 23 Oct 2012 19:38:00 -0000 Message-ID: Subject: Re: PR c/53063 Handle Wformat with LangEnabledBy To: "Joseph S. Myers" Cc: Gcc Patch List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg02081.txt.bz2 On 19 October 2012 18:17, Joseph S. Myers wrote: > On Wed, 17 Oct 2012, Manuel L=F3pez-Ib=E1=F1ez wrote: > >> documentation but I can also implement -Wformat=3D0 being an alias for >> -Wno-format and -Wformat=3D1 an alias for -Wformat and simply reject >> -Wno-format=3D. > > I think that's what's wanted; -Wno-format=3D should be rejected, -Wformat= =3D > should take an arbitrary integer level (of which at present all those > above 2 are equivalent to 2, just as -O for n > 3 is equivalent to > -O3). The problem is how to represent that Wformat-y2k is enabled by -Wformat=3DX with X >=3D 2, while Wformat-zero-length is enabled by X >=3D1. One possiblity is to allow to specify a condition directly: Wformat-y2k C ObjC C++ ObjC++ Var(warn_format_y2k) Warning LangEnabledByCond(C ObjC C++ ObjC++,Wformat=3D,warn_format >=3D 2) Warn about strftime formats yielding 2-digit years Wformat-zero-length C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledByCond(C ObjC C++ ObjC++,Wformat=3D,warn_format >=3D 2) Warn about zero-length formats Wformat=3D C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning I think this is both flexible and easy to implement given the current infrastructure. But I wanted to get your approval before. What do you think?