From 502078c91d8cfbaffead047470a127cb81055200 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Mon, 3 May 2021 22:26:13 +0200 Subject: [PATCH] Do not check the birand/bitor macros in cplusplus mode Some 3rdparty parsers (e.g. Qt moc) fail to parse the bitand.hpp due to the fact that bitand is a keyword in C++, not a macro. Modern MSVC versions define bitand/bitor only if __cplusplus macro is not defined, see iso646.h: https://pastebin.com/zTcd0juT Thus, boost can also check the macro only in C mode making moc happy --- include/boost/mpl/and.hpp | 4 ++-- include/boost/mpl/bitand.hpp | 4 ++-- include/boost/mpl/bitor.hpp | 4 ++-- include/boost/mpl/or.hpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/mpl/and.hpp b/include/boost/mpl/and.hpp index 5032a3b..a6f4892 100644 --- a/include/boost/mpl/and.hpp +++ b/include/boost/mpl/and.hpp @@ -28,7 +28,7 @@ // 'or' and 'and' macros, see http://tinyurl.com/3et69; 'defined(and)' // has to be checked in a separate condition, otherwise GCC complains // about 'and' being an alternative token -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(and) # pragma push_macro("and") @@ -41,7 +41,7 @@ # define BOOST_MPL_PREPROCESSED_HEADER and.hpp # include -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(and) # pragma pop_macro("and") diff --git a/include/boost/mpl/bitand.hpp b/include/boost/mpl/bitand.hpp index 3d75980..82261d0 100644 --- a/include/boost/mpl/bitand.hpp +++ b/include/boost/mpl/bitand.hpp @@ -19,7 +19,7 @@ // macros, see http://tinyurl.com/ycwdxco; 'defined(bitand)' // has to be checked in a separate condition, otherwise GCC complains // about 'bitand' being an alternative token -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(bitand) # pragma push_macro("bitand") @@ -34,7 +34,7 @@ #define AUX778076_OP_TOKEN & #include -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(bitand) # pragma pop_macro("bitand") diff --git a/include/boost/mpl/bitor.hpp b/include/boost/mpl/bitor.hpp index 05348c3..9bd4da2 100644 --- a/include/boost/mpl/bitor.hpp +++ b/include/boost/mpl/bitor.hpp @@ -19,7 +19,7 @@ // macros, see http://tinyurl.com/ycwdxco; 'defined(bitor)' // has to be checked in a separate condition, otherwise GCC complains // about 'bitor' being an alternative token -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(bitor) # pragma push_macro("bitor") @@ -34,7 +34,7 @@ #define AUX778076_OP_TOKEN | #include -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(bitor) # pragma pop_macro("bitor") diff --git a/include/boost/mpl/or.hpp b/include/boost/mpl/or.hpp index da290e3..337e53a 100644 --- a/include/boost/mpl/or.hpp +++ b/include/boost/mpl/or.hpp @@ -29,7 +29,7 @@ // 'or' and 'and' macros, see http://tinyurl.com/3et69; 'defined(or)' // has to be checked in a separate condition, otherwise GCC complains // about 'or' being an alternative token -#if defined(_MSC_VER) +#if defined(_MSC_VER)&& !defined(__cplusplus) #ifndef __GCCXML__ #if defined(or) # pragma push_macro("or") @@ -42,7 +42,7 @@ # define BOOST_MPL_PREPROCESSED_HEADER or.hpp # include -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__cplusplus) #ifndef __GCCXML__ #if defined(or) # pragma pop_macro("or")