From 6bd6d7185026adbdbe398cb6ba162be9e42b9913 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Mon, 18 Mar 2019 20:00:59 +0300 Subject: [PATCH 1/5] Fix -Wregister error on Clang in C++17 mode Suppresses the warning on GCC, Clang, and MSVC. --- include/boost/python/detail/wrap_python.hpp | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp index 9fdb222c..481baa78 100644 --- a/include/boost/python/detail/wrap_python.hpp +++ b/include/boost/python/detail/wrap_python.hpp @@ -145,12 +145,38 @@ typedef int pid_t; #endif // _WIN32 +#if defined(__GNUC__) +# if defined(__has_warning) +# define BOOST_PYTHON_GCC_HAS_WREGISTER __has_warning("-Wregister") +# else +# define BOOST_PYTHON_GCC_HAS_WREGISTER __GNUC__ >= 7 +# endif +#else +# define BOOST_PYTHON_GCC_HAS_WREGISTER 0 +#endif + +// Python.h header uses `register` keyword until Python 3.4 +#if BOOST_PYTHON_GCC_HAS_WREGISTER +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wregister" +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable : 5033) // 'register' is no longer a supported storage class +#endif + #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2 # include #else # include #endif +#if BOOST_PYTHON_GCC_HAS_WREGISTER +# pragma GCC diagnostic pop +#elif defined(_MSC_VER) +# pragma warning(pop) +#endif +#undef BOOST_PYTHON_GCC_HAS_WREGISTER + #ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED # undef ULONG_MAX # undef BOOST_PYTHON_ULONG_MAX_UNDEFINED From 1f1b9b6aefd2a9464d335a627f94ebf6a9e4ebf9 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sat, 23 Mar 2019 01:47:38 +0300 Subject: [PATCH 2/5] Fix hypot issue on MinGW --- include/boost/python/detail/wrap_python.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp index 481baa78..c0748ddf 100644 --- a/include/boost/python/detail/wrap_python.hpp +++ b/include/boost/python/detail/wrap_python.hpp @@ -83,6 +83,13 @@ // than MSVC on Win32 // #if defined(_WIN32) || defined(__CYGWIN__) + +// Python.h defines a macro with hypot name, what breaks libstdc++ math header +// that it tries to include afterwards. +# if defined(__MINGW32__) +# include +# endif + # if defined(__GNUC__) && defined(__CYGWIN__) # if defined(__LP64__) From 72e254bf8b9ab847343bfbc85b31e723ebb66309 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 28 Sep 2018 09:30:33 +0100 Subject: [PATCH 3/5] Fix name of file in tutorial I think it's meant to refer to the Jamroot file being discussed, not Jamrules. --- doc/tutorial.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorial.qbk b/doc/tutorial.qbk index 71d25850..d7c0cfa9 100644 --- a/doc/tutorial.qbk +++ b/doc/tutorial.qbk @@ -121,7 +121,7 @@ __jam__ file. Simply copy the file and tweak [^use-project boost] to where your boost root directory is and you're OK. -The comments contained in the Jamrules file above should be sufficient +The comments contained in the Jamroot file above should be sufficient to get you going. [h2 Running bjam] From 0d0cd711a764a3b32d2cd19a1049eb9f36b4fd06 Mon Sep 17 00:00:00 2001 From: Owens Date: Fri, 17 Aug 2018 06:06:03 +1000 Subject: [PATCH 4/5] Enable forward declaration of unwind_type() in msvc14.15 and later. Name lookup in msvc has changed between 14.14 and 14.15 making it consistent with other compilers. Forward declaration of unwind_type() is now required as it is for other compilers. Resolves compilation errors identified in: https://github.com/boostorg/python/issues/228 --- include/boost/python/detail/unwind_type.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/boost/python/detail/unwind_type.hpp b/include/boost/python/detail/unwind_type.hpp index f6cdab64..b81bf7c8 100644 --- a/include/boost/python/detail/unwind_type.hpp +++ b/include/boost/python/detail/unwind_type.hpp @@ -11,13 +11,15 @@ namespace boost { namespace python { namespace detail { -#ifndef _MSC_VER //if forward declared, msvc6.5 does not recognize them as inline -// forward declaration, required (at least) by Tru64 cxx V6.5-042 +#if (!defined(_MSC_VER) || _MSC_VER >= 1915) +// If forward declared, msvc6.5 does not recognize them as inline. +// However, as of msvc14.15 (_MSC_VER 1915/Visual Studio 15.8.0) name lookup is now consistent with other compilers. +// forward declaration, required (at least) by Tru64 cxx V6.5-042 and msvc14.15 template inline typename Generator::result_type unwind_type(U const& p, Generator* = 0); -// forward declaration, required (at least) by Tru64 cxx V6.5-042 +// forward declaration, required (at least) by Tru64 cxx V6.5-042 and msvc14.15 template inline typename Generator::result_type unwind_type(boost::type*p = 0, Generator* = 0); @@ -83,7 +85,7 @@ struct unwind_helper template inline typename Generator::result_type -#ifndef _MSC_VER +#if (!defined(_MSC_VER) || _MSC_VER >= 1915) unwind_type(U const& p, Generator*) #else unwind_type(U const& p, Generator* = 0) @@ -148,7 +150,7 @@ struct unwind_helper2 // why bother? template inline typename Generator::result_type -#ifndef _MSC_VER +#if (!defined(_MSC_VER) || _MSC_VER >= 1915) unwind_type(boost::type*, Generator*) #else unwind_type(boost::type*p =0, Generator* =0) From 0b0c0536d6f367768152a91799e7ea1eb02f91c6 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Tue, 26 Mar 2019 21:02:08 +0300 Subject: [PATCH 5/5] The right hypot fix for MinGW --- include/boost/python/detail/wrap_python.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp index c0748ddf..13679dbb 100644 --- a/include/boost/python/detail/wrap_python.hpp +++ b/include/boost/python/detail/wrap_python.hpp @@ -47,6 +47,13 @@ # endif #endif +// pyconfig.h defines a macro with hypot name, what breaks libstdc++ math headers +// that Python.h tries to include afterwards. +#if defined(__MINGW32__) +# include +# include +#endif + # include # if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740 # undef _POSIX_C_SOURCE @@ -84,12 +91,6 @@ // #if defined(_WIN32) || defined(__CYGWIN__) -// Python.h defines a macro with hypot name, what breaks libstdc++ math header -// that it tries to include afterwards. -# if defined(__MINGW32__) -# include -# endif - # if defined(__GNUC__) && defined(__CYGWIN__) # if defined(__LP64__)