diff --git a/pyconfig.h b/pyconfig.h index 35a6bf1e..cd90e7d7 100644 --- a/pyconfig.h +++ b/pyconfig.h @@ -19,7 +19,7 @@ # define PY_INLINE_FRIEND ::py # endif -# if !defined(__GNUC__) && !defined(__MWERKS__) && !defined(__BORLANDC__) && defined(_MSC_VER) +# if defined(BOOST_MSVC) # define PY_COMPILER_IS_MSVC 1 # if _MSC_VER <= 1200 # define PY_MSVC6_OR_EARLIER 1 @@ -29,6 +29,17 @@ # endif +// Work around the broken library implementation/strict ansi checking on some +// EDG-based compilers (e.g. alpha), which incorrectly warn that the result of +// offsetof() is not an integer constant expression. +# if defined(__DECCXX_VER) && __DECCXX_VER <= 60290024 +# define PY_OFFSETOF(s_name, s_member) \ + ((size_t)__INTADDR__(&(((s_name *)0)->s_member))) +# else +# define PY_OFFSETOF(s_name, s_member) \ + offsetof(s_name, s_member) +# endif + // The STLport puts all of the standard 'C' library names in std (as far as the // user is concerned), but without it you need a fix if you're using MSVC. # if defined(PY_MSVC6_OR_EARLIER) && !defined(__STLPORT)