Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-01 05:19:16


Pavel Kuznetsov wrote:
> It seems that boost code is written to avoid compilers warnings.
> Though some warnings do slip into MSVC++ builds when boost headers
> are included. Most (all?) of these are the warnings which are turned
> of by default. In particular sometimes I can see C4668 warnings shown:
>
> boost\boost\mem_fn.hpp(296) : warning C4668:
> '__MWERKS__' is not defined as a preprocessor macro,
> replacing with '0' for '#if/#elif'
>
> Where boost\boost\mem_fn.hpp(296) is:
>
> #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) &&
> !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))

Right. The problem is that our tests do not have C4668 or -Wundef enabled,
so we can't see the warning on the regression report, and it's too easy to
reintroduce it.

> Where BOOST_WORKAROUND is:
>
> # define BOOST_WORKAROUND(symbol, test) \
> ((symbol != 0) && (1 % (( (symbol test) ) + 1)))
>
> It seems that in some places authors are aware of the problem stated.
> E.g.: boost\boost\intrusive_ptr.hpp(124):
>
> #if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= x530)

That is correct, some authors are aware of the problem (me). ;-)

> So I see two ways to eliminate the warning in question: either
> suppress it with corresponding #pragmas, or rewrite BOOST_WORKAROUND
> so that it would test whether 'symbol' is defined before comparing it
> to 0.

You can't disable the g++ warning with a pragma, and you can't rewrite
BOOST_WORKAROUND to test whether the symbol is defined.


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