This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add new CPP arithmetic warning?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]