This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Add new CPP arithmetic warning?
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Neil Booth <neil at daikokuya dot co dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 17 Jul 2002 19:28:52 -0700
- Subject: Re: Add new CPP arithmetic warning?
- References: <20020717230155.GA20944@daikokuya.co.uk>
On Thu, Jul 18, 2002 at 12:01:55AM +0100, Neil Booth wrote:
> Zack,
>
> I noticed EDG gives a warning about integer promotion for the
> following:
>
> #if -1 + 6U
> #endif
This looks like a good warning to have. I think it should be on with
-Wall, since people may have intentionally written this sort of thing
instead of ~0U. You're right that it should be in the compiler proper
too, but putting it in #if is good by itself - the type rules for #if
are not what people expect, we should give them lots of help.
> I can't recall their wording off-hand. I thought this was a good
> idea, so I coded it up too. It needed a slight re-work of the
> reduction code, which, going through a function pointer, was kind
> of awkward anyway. The re-work forms the bulk of the patch, the
> code to add the warning is not much in and of itself.
Would you mind splitting it up? Do the rework, apply that, then send
in the patch to add the warning, which might conceivably be
controversial.
zw