public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Manuel López-Ibáñez" <lopezibanez@gmail.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: PR c/53063 Handle Wformat with LangEnabledBy
Date: Tue, 23 Oct 2012 19:38:00 -0000	[thread overview]
Message-ID: <CAESRpQByQJBAWhMtX3iJQUAePdq6Ov7nhThMAgM4MR2yyeV1Wg@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1210191615570.4249@digraph.polyomino.org.uk>

On 19 October 2012 18:17, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Wed, 17 Oct 2012, Manuel López-Ibáñez wrote:
>
>> documentation but I can also implement -Wformat=0 being an alias for
>> -Wno-format and -Wformat=1 an alias for -Wformat and simply reject
>> -Wno-format=.
>
> I think that's what's wanted; -Wno-format= should be rejected, -Wformat=
> should take an arbitrary integer level (of which at present all those
> above 2 are equivalent to 2, just as -O<n> for n > 3 is equivalent to
> -O3).

The problem is how to represent that Wformat-y2k is enabled by
-Wformat=X with X >= 2, while Wformat-zero-length is enabled by X >=1.

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=,warn_format >= 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=,warn_format >= 2)
Warn about zero-length formats

Wformat=
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?

  reply	other threads:[~2012-10-23 19:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 22:24 Manuel López-Ibáñez
2012-10-19 16:22 ` Joseph S. Myers
2012-10-23 19:38   ` Manuel López-Ibáñez [this message]
2012-10-24  0:54     ` Joseph S. Myers
2012-10-27 17:03   ` Manuel López-Ibáñez
2012-11-03 17:19     ` Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAESRpQByQJBAWhMtX3iJQUAePdq6Ov7nhThMAgM4MR2yyeV1Wg@mail.gmail.com \
    --to=lopezibanez@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).