Re: GCC 3.3.1, new warnings with <limits>

From: Craig Rodrigues <rodrigc_at_crodrigues.org>
Date: Sun, 13 Jul 2003 00:43:31 -0400
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
Received on Sat Jul 12 2003 - 19:42:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:14 UTC