File tree Expand file tree Collapse file tree
include/boost/python/detail Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,12 +145,38 @@ typedef int pid_t;
145145
146146#endif // _WIN32
147147
148+ #if defined(__GNUC__)
149+ # if defined(__has_warning)
150+ # define BOOST_PYTHON_GCC_HAS_WREGISTER __has_warning (" -Wregister" )
151+ # else
152+ # define BOOST_PYTHON_GCC_HAS_WREGISTER __GNUC__ >= 7
153+ # endif
154+ #else
155+ # define BOOST_PYTHON_GCC_HAS_WREGISTER 0
156+ #endif
157+
158+ // Python.h header uses `register` keyword until Python 3.4
159+ #if BOOST_PYTHON_GCC_HAS_WREGISTER
160+ # pragma GCC diagnostic push
161+ # pragma GCC diagnostic ignored "-Wregister"
162+ #elif defined(_MSC_VER)
163+ # pragma warning(push)
164+ # pragma warning(disable : 5033) // 'register' is no longer a supported storage class
165+ #endif
166+
148167#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2
149168# include < boost/python/detail/python22_fixed.h>
150169#else
151170# include < Python.h>
152171#endif
153172
173+ #if BOOST_PYTHON_GCC_HAS_WREGISTER
174+ # pragma GCC diagnostic pop
175+ #elif defined(_MSC_VER)
176+ # pragma warning(pop)
177+ #endif
178+ #undef BOOST_PYTHON_GCC_HAS_WREGISTER
179+
154180#ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED
155181# undef ULONG_MAX
156182# undef BOOST_PYTHON_ULONG_MAX_UNDEFINED
You can’t perform that action at this time.
0 commit comments