Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 2003 00:43:31 -0400
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        Alexander Kabaev <kabaev@mail.ru>
Cc:        freebsd-current@freebsd.org
Subject:   Re: GCC 3.3.1, new warnings with <limits>
Message-ID:  <20030713044331.GA89785@crodrigues.org>
In-Reply-To: <20030713000559.28c18be6.kabaev@mail.ru>
References:  <20030712155333.GA79322@crodrigues.org> <BEDC8C48-B4DC-11D7-BE3B-0003937E39E0@mac.com> <20030713031312.GA89014@crodrigues.org> <20030713000559.28c18be6.kabaev@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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@crodrigues.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030713044331.GA89785>