Supressing GCCs 'MACRONAME' is not defined [-Wundef]
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 -- Softwareentwicklung iDev GmbH Spichernstr. 73 50672 Köln Tel: +49 221 / 222 858-0 Fax: +49 221 / 222 858-20 E-Mail: himmes@idev.de WWW: www.idev.de AG Köln HRB 58720 Geschäftsführung: Michael Mertens
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
On 9 March 2013 15:23, Richard Damon
On 3/8/13 5:53 AM, Roman Himmes wrote:
#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 0
[snip]
I suspect that you are solving a non-problem. Undefined macros in preprocessor statements have a defined behavior, namely they evaluate to 0
True, but we usually try to avoid these warnings, as they can be useful. I'd suggest the original poster try opening tickets for the relevant libraries. I don't know how responsive their maintainers will be. I'll fix the iostreams one myself, since it's mostly unmaintained.
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.
Unfortunately not. The macros are library specific macros, so when they're defined, they're defined after config.hpp is included.
participants (3)
-
Daniel James
-
Richard Damon
-
Roman Himmes