Boost logo

Boost Users :

Subject: Re: [Boost-users] Supressing GCCs 'MACRONAME' is not defined [-Wundef]
From: Richard Damon (Richard_at_[hidden])
Date: 2013-03-09 10:23:07


On 3/8/13 5:53 AM, Roman Himmes wrote:
> Hi!
>
> After compiling boost_1_53_0 I got a lot of MACROS are not defined
> messages compiling my project.
> To suppress those warnings I changed the boost/config.hpp and appended:
>
> #define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 0
> #define BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES 0
> #define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 0
> #define BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE 0
> #define BOOST_PP_VARIADICS_MSVC 0
> #define BOOST_IOSTREAMS_GCC_WORKAROUND_GUARD 0
> #define BOOST_SELECT_BY_SIZE_MAX_CASE 0
> #define BOOST_PP_VARIADICS_MSVC 0
> #define BOOST_FT_CC_IMPLICIT 0
> #define BOOST_FT_CC_CDECL 0
> #define BOOST_FT_CC_STDCALL 0
> #define BOOST_FT_CC_PASCAL 0
> #define BOOST_FT_CC_FASTCALL 0
> #define BOOST_FT_CC_CLRCALL 0
> #define BOOST_FT_CC_THISCALL 0
> #define BOOST_FT_CC_IMPLICIT_THISCALL 0too
>
> I realize that this is very dangerous and definitly not the way to go.
> Any Idea how to suppress those warnings correctly?
>
> I am using Arch-Linux with gcc-4.7.2.
> I compiled boost with (as far as I remember):
>
> ./b2 toolset=gcc cxxflags=-std=c++11 link=static stage
>
> Best Regards,
>
> Roman Himmes
>
I suspect that you are solving a non-problem. Undefined macros in
preprocessor statements have a defined behavior, namely they evaluate to 0

If you do really want to be clean under -Wundef use code more like this
at the end of the file:

#ifundef BOOST_xxxx
#define BOOST_xxxx 0
#endif

This will only define those macros which are undefined, so in the
future, if config.hpp defines their value you won't get an error.

-- 
Richard Damon

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net