Boost logo

Boost :

Subject: Re: [boost] Can we suppress integer_traits warnings?
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2009-10-26 05:47:12


John Maddock wrote:
> If you have a program that simply includes boost/integer_traits.hpp
> and is compiled with g++ -pedantic you get a bunch of warnings:
>
> ./boost/integer_traits.hpp:164:57: warning: use of C99 long long
> integer constant
> ./boost/integer_traits.hpp:164:73: warning: use of C99 long long
> integer constant
> ./boost/integer_traits.hpp:170:62: warning: use of C99 long long
> integer constant
> ./boost/integer_traits.hpp:170:62: warning: use of C99 long long
> integer constant
>
> And no matter where I insert __extension__ I can't seem to get gcc to
> suppress these:-(
>
> Any ideas?
>
> BTW I'm asking because this came to me as a - somewhat misplaced -
> bug report: https://svn.boost.org/trac/boost/ticket/1451.
>
> Thanks, John.
>

gcc has a pragma to do just that
#pragma GCC diagnostic ignored "-Wlong-long"

dgoncharov_at_localhost /root/testsrc/diag $ cat main.cpp
#include <boost/integer_traits.hpp>

//#pragma GCC diagnostic ignored "-Wlong-long"

int main()
{
        typedef boost::integer_traits<long long> traits;
        bool const a = traits::is_integer;
        (void) a;
        return 0;
}

dgoncharov_at_localhost /root/testsrc/diag $ g++ main.cpp -Wall -Wextra
-pedantic
main.cpp: In function 'int main()':
main.cpp:8: warning: ISO C++ 1998 does not support 'long long'
dgoncharov_at_localhost /root/testsrc/diag $ vim main.cpp
dgoncharov_at_localhost /root/testsrc/diag $ cat main.cpp
#include <boost/integer_traits.hpp>

#pragma GCC diagnostic ignored "-Wlong-long"

int main()
{
        typedef boost::integer_traits<long long> traits;
        bool const a = traits::is_integer;
        (void) a;
        return 0;
}

dgoncharov_at_localhost /root/testsrc/diag $ g++ main.cpp -Wall -Wextra
-pedantic
dgoncharov_at_localhost /root/testsrc/diag $
 

BR, Dmitry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk