public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Simon Baldwin <simonb@google.com>
To: tromey@redhat.com
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH][RFC] -Wno-... option to suppress builtin macro redefined   warnings
Date: Fri, 15 Aug 2008 17:28:00 -0000	[thread overview]
Message-ID: <48A5B2C6.1090600@google.com> (raw)
In-Reply-To: <489C728B.4040505@google.com>

Simon Baldwin wrote:
> Tom Tromey wrote:
>>>>>>> "Simon" == Simon Baldwin <simonb@google.com> writes:
>>>>>>>             
>>
>> ...
>> However, it seems to me that we would want to allow redefinition of
>> some macros (__TIME__ et al) but not others (e.g., __LINE__).
>>
>> So, how about splitting builtin_array into two pieces (and just FYI,
>> there's a comment above referring to "two tables" that should be
>> changed) and then unconditionally setting NODE_WARN for one table but
>> not the other?  Or, just adding a special case in the builtin
>> definition loop for the BT_* constants we care to allow.
>>   
>
> Thank you for the note.
>
> I guess that in general it just seems more, um, seamless to either 
> allow or disallow any builtin macro to be redefined.  It means that 
> there's no "is it redefinable or not?" decision to be made when new 
> builtins are added.  It also neatly sidesteps the issue of then having 
> to document which builtins are redefinable and which aren't (also no 
> update to this doc should new builtins be added), or having to deal 
> with requests to move builtins between redefinable/fixed groups.  In 
> other words, the lowest impact on future code maintainers consistent 
> with low impact on current code.
>
> Granted, somebody could well redefine __LINE__ or similar and make a 
> mess of compilation, but there are of course plenty of other ways to 
> make a mess of compilation with other gcc flags.  
> -Wno-builtin-macro-redefined is aimed at the control-freak automated 
> build system rather than the casual user, so it seemed okay, to me 
> anyway, for it to bear closer resemblance to a chainsaw than to a 
> scalpel.
>
> That said, I'm not wildly opposed to creating two "classes" of 
> builtin.  It just seems like doing so might sow slightly more 
> confusion than it prevents.

Tom, any further thoughts on this?

It's certainly not hard to split built-in macros into two tiers, those 
where redefinition warning can be suppressed by providing 
-Wno-builtin-macro-redefined, and those where it can't.  However, since 
it's all just about suppressing a warning, it may be that one policy to 
cover all of them will suffice, and be simpler to manage and maintain.

Thanks.

  reply	other threads:[~2008-08-15 16:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 15:12 Simon Baldwin
2008-07-30 15:27 ` Joseph S. Myers
2008-08-08 16:01 ` Tom Tromey
2008-08-08 16:09   ` Manuel López-Ibáñez
2008-08-08 16:21     ` Tom Tromey
2008-08-08 16:23   ` Simon Baldwin
2008-08-15 17:28     ` Simon Baldwin [this message]
     [not found]       ` <48AEE7A7.9000509@google.com>
2008-08-22 17:17         ` Tom Tromey
2008-08-26 18:38           ` Simon Baldwin
2008-09-02 11:29             ` Simon Baldwin
2008-09-13  7:42             ` Tom Tromey
2008-09-16 16:11               ` Simon Baldwin
2008-09-17 14:19               ` Ian Lance Taylor
2008-09-18 16:04                 ` Simon Baldwin
2008-09-17 14:24             ` Ian Lance Taylor
2008-08-22 16:53 Simon Baldwin

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=48A5B2C6.1090600@google.com \
    --to=simonb@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tromey@redhat.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).