This is the mail archive of the
mailing list for the GCC project.
Re: Patch -Wtraditional, warn about `U' integer constant suffix
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: Patch -Wtraditional, warn about `U' integer constant suffix
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Mon, 7 Aug 2000 14:28:36 -0700
- Cc: rth at cygnus dot com, gavin at cygnus dot com, gcc-patches at gcc dot gnu dot org
- References: <200008071758.NAA08902@caip.rutgers.edu>
On Mon, Aug 07, 2000 at 01:58:58PM -0400, Kaveh R. Ghazi wrote:
> Hmm, I've come across a problem in practice with this. I'd like to
> solicit opinions on how to proceed.
> Suppose you have the following code:
> > #include <limits.h>
> > unsigned int i = UINT_MAX;
> and suppose that your system is a modern one supporting U so limits.h
> defines UINT_MAX to 4294967295U. Now you are hosed, there is no way
> to silence the warning. Even though UINT_MAX is defined in a system
> header, the use of it occurs in user code so the warning will appear.
> Ditto for uses in cpp #if conditionals.
> Any suggestions on how to avoid this problem?
__extension__ isn't appropriate and would require modifying the system
In theory, you could preserve information about where each macro
definition came from. For all macros defined in system headers,
toggle system-header-ness on and off when you step in and out of the
expansion. This may be possible right now for warnings generated by
the preprocessor. The compiler doesn't have access to that level of
detail - the integrated preprocessor mode *could* do it, but you'd
have to augment the interface. All in all, more work than I have time
for right now.