GCC 3.3.1, new warnings with <limits>
Craig Rodrigues
rodrigc at crodrigues.org
Sat Jul 12 21:42:30 PDT 2003
On Sun, Jul 13, 2003 at 12:05:59AM -0400, Alexander Kabaev wrote:
> On Sat, 12 Jul 2003 23:13:12 -0400
> Craig Rodrigues <rodrigc at crodrigues.org> wrote:
>
> > I am guessing that the C preprocessor does not think that it is
> > in a system header, and thus prints out the warning.
>
> We specifically disable automatic warning suppression for system
> headers, because we _want_ to know about them. Your Linux distribution
> apparently does not care.
How do you disable/enable warning suppression for system headers?
I am not familiar enough with how GCC works in this area.
> > Any GCC/FreeBSD expert care to comment? ;)
> >
> Short of fixing offending files in FSF libstdc++ or turning warning
> suppression back on for standard C++ include files selectively, I have
> no suggestion.
Hmm, I'm not sure what to recommend here either. I'd like to see
this fixed somewhere, because this increases the warning output
for some large C++ projects that I work with (I like to see warnings
also).
The warnings seemed to be caused by this code in
/usr/include/c++/3.3/limits:
=========================================================================
630 static const int digits = __glibcpp_digits (unsigned int);
631 static const int digits10 = __glibcpp_digits10 (unsigned int);
=========================================================================
The macros are defined in the same file here:
============================================================================
134 #define __glibcpp_signed(T) ((T)(-1) < 0)
142 #define __glibcpp_digits(T) \
143 (sizeof(T) * __CHAR_BIT__ - __glibcpp_signed (T))
============================================================================
The expanded macros look like:
static const int digits = (sizeof(unsigned int) * 8 - ((unsigned int)(-1) < 0));
static const int digits10 = ((sizeof(unsigned int) * 8 - ((unsigned int)(-1) < 0)) * 643 / 2136);
I don't really know how to fix this. Maybe introduce a new macro?
#define __glibcpp_unsigned_digits(T) \
(sizeof(T) * __CHAR_BIT__
and then use that macro only for unsigned quantities?
Thanks.
--
Craig Rodrigues
http://crodrigues.org
rodrigc at crodrigues.org
More information about the freebsd-current
mailing list