public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <bonzini@gnu.org>
To: Joseph Myers <joseph@codesourcery.com>
Cc: "Manuel López-Ibáñez" <lopezibanez@gmail.com>,
	"Gcc Patch List" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] cpp/c: Add -Wexpansion-to-defined
Date: Wed, 10 Aug 2016 15:51:00 -0000	[thread overview]
Message-ID: <8b5eadee-eb4b-75a2-3f06-a11fae56600a@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.20.1608101532210.1285@digraph.polyomino.org.uk>



On 10/08/2016 17:33, Joseph Myers wrote:
> On Wed, 10 Aug 2016, Paolo Bonzini wrote:
> 
>> - stuff that is not enabled by anything should use OPT_Wpedantic, and
> 
> No, lots of pedwarns are for usages that are (a) dubious enough we want to 
> diagnose them by default, and (b) required to be diagnosed by ISO C so 
> must become errors with -pedantic-errors.  (You could argue about whether 
> we should have -fpermissive for C like for C++ and make some of those into 
> errors by default.)

There are indeed many pedwarn(loc, 0, ...) occurrences in C++ (most, but
not all, are "foo only available with -std=bar" which in the C front-end
would use OPT_Wpedantic, OPT_W*compat be enabled by specific flags such
as -Wvariadic-macros).  In C I only see three:

- overflowing floating-point constants:

          if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
            pedwarn (input_location, 0,
                     "floating constant exceeds range of %qT", type);
          else
            warning (OPT_Woverflow,
                     "floating constant exceeds range of %qT", type);

- __FUNCTION__ outside function scope

  if (!ix && !current_function_decl)
    pedwarn (loc, 0, "%qD is not defined outside of function scope", decl);

- macro redefinition

For the first two it would not feel wrong at all to use permerror.  The
last one indeed is a very good example of a pedwarn.

Paolo

  reply	other threads:[~2016-08-10 15:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 10:06 Paolo Bonzini
2016-08-10 11:32 ` Manuel López-Ibáñez
2016-08-10 11:53   ` Joseph Myers
2016-08-10 12:06   ` Paolo Bonzini
2016-08-10 14:43     ` Manuel López-Ibáñez
2016-08-10 14:45       ` Paolo Bonzini
2016-08-10 15:25         ` Manuel López-Ibáñez
2016-08-10 15:29           ` Paolo Bonzini
2016-08-10 15:33             ` Joseph Myers
2016-08-10 15:51               ` Paolo Bonzini [this message]
2016-08-10 15:58                 ` Joseph Myers
2016-08-10 16:01                   ` Paolo Bonzini
2016-08-11  3:02 ` Sandra Loosemore

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=8b5eadee-eb4b-75a2-3f06-a11fae56600a@gnu.org \
    --to=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=lopezibanez@gmail.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).