Skip to content

Commit

Permalink
python: Remove use of BOOST_WORKAROUND macro
Browse files Browse the repository at this point in the history
This macro is used to guard compiler-specific workarounds for
non-conforming behavior. These workarounds are all for compilers
or versions of compilers that OpenUSD does not support.

(Internal change: 2341134)
  • Loading branch information
sunyab authored and pixar-oss committed Sep 17, 2024
1 parent 8a04b08 commit 2bcdfba
Show file tree
Hide file tree
Showing 37 changed files with 15 additions and 282 deletions.
14 changes: 0 additions & 14 deletions pxr/external/boost/python/arg_from_python.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,17 @@

# include "pxr/external/boost/python/detail/prefix.hpp"
# include "pxr/external/boost/python/converter/arg_from_python.hpp"
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
# include "pxr/external/boost/python/detail/type_traits.hpp"
#endif

namespace PXR_BOOST_NAMESPACE { namespace python {

template <class T>
struct arg_from_python
: converter::select_arg_from_python<
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
typename detail::remove_cv<T>::type
# else
T
# endif
>::type
{
typedef typename converter::select_arg_from_python<
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
typename detail::remove_cv<T>::type
# else
T
# endif
>::type base;

arg_from_python(PyObject*);
Expand Down
3 changes: 0 additions & 3 deletions pxr/external/boost/python/call.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ namespace PXR_BOOST_NAMESPACE { namespace python {
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, call.hpp)
# endif

# define N BOOST_PP_ITERATION()

Expand Down
3 changes: 0 additions & 3 deletions pxr/external/boost/python/call_method.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ namespace PXR_BOOST_NAMESPACE { namespace python {
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, call_method.hpp)
# endif

# define N BOOST_PP_ITERATION()

Expand Down
34 changes: 1 addition & 33 deletions pxr/external/boost/python/class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,7 @@
# include <boost/mpl/for_each.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/mpl/not.hpp>

# include <boost/detail/workaround.hpp>

# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) \
/* pro9 reintroduced the bug */ \
|| (BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))

# define PXR_BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING 1

# endif

# ifdef PXR_BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
# include <boost/mpl/and.hpp>
# endif
# include <boost/mpl/and.hpp>

namespace PXR_BOOST_NAMESPACE { namespace python {

Expand Down Expand Up @@ -97,16 +83,6 @@ namespace detail
>
{};

# ifdef PXR_BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
# define PXR_BOOST_PYTHON_DATA_MEMBER_HELPER(D) , detail::is_data_member_pointer<D>()
# define PXR_BOOST_PYTHON_YES_DATA_MEMBER , mpl::true_
# define PXR_BOOST_PYTHON_NO_DATA_MEMBER , mpl::false_
# else
# define PXR_BOOST_PYTHON_DATA_MEMBER_HELPER(D)
# define PXR_BOOST_PYTHON_YES_DATA_MEMBER
# define PXR_BOOST_PYTHON_NO_DATA_MEMBER
# endif

namespace error
{
//
Expand Down Expand Up @@ -143,9 +119,6 @@ namespace detail
{
// https://svn.boost.org/trac/boost/ticket/5803
//typedef typename assertion<mpl::not_<detail::is_same<Default,Fn> > >::failed test0;
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
typedef typename assertion<detail::is_polymorphic<T> >::failed test1 BOOST_ATTRIBUTE_UNUSED;
# endif
typedef typename assertion<detail::is_member_function_pointer<Fn> >::failed test2 BOOST_ATTRIBUTE_UNUSED;
not_a_derived_class_member<Default>(Fn());
}
Expand Down Expand Up @@ -608,10 +581,5 @@ inline class_<W,X1,X2,X3>::class_(char const* name, char const* doc, no_init_t)

}} // namespace PXR_BOOST_NAMESPACE::python

# undef PXR_BOOST_PYTHON_DATA_MEMBER_HELPER
# undef PXR_BOOST_PYTHON_YES_DATA_MEMBER
# undef PXR_BOOST_PYTHON_NO_DATA_MEMBER
# undef PXR_BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING

#endif // PXR_USE_INTERNAL_BOOST_PYTHON
#endif // PXR_EXTERNAL_BOOST_PYTHON_CLASS_HPP
3 changes: 0 additions & 3 deletions pxr/external/boost/python/converter/registered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "pxr/external/boost/python/converter/registry.hpp"
#include "pxr/external/boost/python/converter/registrations.hpp"
#include "pxr/external/boost/python/detail/type_traits.hpp"
#include <boost/detail/workaround.hpp>
#include <boost/type.hpp>
#include <memory>
#if defined(PXR_BOOST_PYTHON_TRACE_REGISTRY) \
Expand Down Expand Up @@ -65,15 +64,13 @@ struct registered
{
};

# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
// collapses a few more types to the same static instance. MSVC7.1
// fails to strip cv-qualification from array types in typeid. For
// some reason we can't use this collapse there or array converters
// will not be found.
template <class T>
struct registered<T&>
: registered<T> {};
# endif

//
// implementations
Expand Down
6 changes: 0 additions & 6 deletions pxr/external/boost/python/converter/registrations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# include "pxr/external/boost/python/converter/constructor_function.hpp"
# include "pxr/external/boost/python/converter/to_python_function_type.hpp"

# include <boost/detail/workaround.hpp>

namespace PXR_BOOST_NAMESPACE { namespace python { namespace converter {

Expand Down Expand Up @@ -81,11 +80,6 @@ struct PXR_BOOST_PYTHON_DECL registration
// True iff this type is a shared_ptr. Needed for special rvalue
// from_python handling.
const bool is_shared_ptr;

# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
private:
void operator=(registration); // This is not defined, and just keeps MWCW happy.
# endif
};

//
Expand Down
16 changes: 0 additions & 16 deletions pxr/external/boost/python/data_members.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
# include <boost/mpl/if.hpp>
# include <boost/mpl/vector/vector10.hpp>

# include <boost/detail/workaround.hpp>

namespace PXR_BOOST_NAMESPACE { namespace python {

//
Expand Down Expand Up @@ -157,12 +155,6 @@ namespace detail
// which don't support partial ordering at all and should always be
// passed 0L.


#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template <class D, class P>
inline object make_getter(D& d, P& p, detail::false_, ...);
#endif

// Handle non-member pointers with policies
template <class D, class Policies>
inline object make_getter(D* d, Policies const& policies, detail::false_, int)
Expand All @@ -184,11 +176,7 @@ namespace detail
template <class C, class D, class Policies>
inline object make_getter(D C::*pm, Policies const& policies, detail::true_, int)
{
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
typedef typename detail::remove_cv<C>::type Class;
#else
typedef C Class;
#endif
return python::make_function(
detail::member<D,Class>(pm)
, policies
Expand Down Expand Up @@ -275,15 +263,13 @@ inline object make_getter(D& x)
return detail::make_getter(x, policy, detail::is_member_pointer<D>(), 0L);
}

# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template <class D>
inline object make_getter(D const& d)
{
detail::not_specified policy
= detail::not_specified(); // Suppress a SunPro warning
return detail::make_getter(d, policy, detail::is_member_pointer<D>(), 0L);
}
# endif

//
// make_setter function family -- build a callable object which
Expand All @@ -310,13 +296,11 @@ inline object make_setter(D& x)
return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0);
}

# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template <class D>
inline object make_setter(D const& x)
{
return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0);
}
# endif

}} // namespace PXR_BOOST_NAMESPACE::python

Expand Down
13 changes: 0 additions & 13 deletions pxr/external/boost/python/def_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#else

# include "pxr/external/boost/python/detail/prefix.hpp"
# include <boost/detail/workaround.hpp>

namespace PXR_BOOST_NAMESPACE { namespace python {

Expand All @@ -27,13 +26,7 @@ template <class T, class X1, class X2, class X3> class class_;

class def_visitor_access
{
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
// Tasteless as this may seem, making all members public allows member templates
// to work in the absence of member template friends.
public:
# else
template <class Derived> friend class def_visitor;
# endif

// unnamed visit, c.f. init<...>, container suites
template <class V, class classT>
Expand Down Expand Up @@ -62,13 +55,7 @@ class def_visitor
{
friend class def_visitor_access;

# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
// Tasteless as this may seem, making all members public allows member templates
// to work in the absence of member template friends.
public:
# else
template <class T, class X1, class X2, class X3> friend class class_;
# endif

// unnamed visit, c.f. init<...>, container suites
template <class classT>
Expand Down
7 changes: 0 additions & 7 deletions pxr/external/boost/python/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#else

# include <boost/config.hpp>
# include <boost/detail/workaround.hpp>

# if defined(BOOST_MSVC)

Expand Down Expand Up @@ -80,13 +79,7 @@
# define PXR_BOOST_PYTHON_DECL_EXCEPTION
#endif

#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// Replace broken Tru64/cxx offsetof macro
# define PXR_BOOST_PYTHON_OFFSETOF(s_name, s_member) \
((size_t)__INTADDR__(&(((s_name *)0)->s_member)))
#else
# define PXR_BOOST_PYTHON_OFFSETOF offsetof
#endif

// enable automatic library variant selection ------------------------------//

Expand Down
1 change: 0 additions & 1 deletion pxr/external/boost/python/detail/destroy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#else

# include "pxr/external/boost/python/detail/type_traits.hpp"
# include <boost/detail/workaround.hpp>
namespace PXR_BOOST_NAMESPACE { namespace python { namespace detail {

template <bool array> struct value_destroyer;
Expand Down
1 change: 0 additions & 1 deletion pxr/external/boost/python/detail/enable_if.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#else

# include "pxr/external/boost/python/detail/sfinae.hpp"
# include <boost/detail/workaround.hpp>

# include <boost/utility/enable_if.hpp>

Expand Down
6 changes: 0 additions & 6 deletions pxr/external/boost/python/detail/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ result(X const&, short = 0) { return 0; }
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == PXR_BOOST_PYTHON_FUNCTION_POINTER
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, result.hpp(function pointers))
# endif

# define N BOOST_PP_ITERATION()

Expand All @@ -124,10 +121,7 @@ boost::type<R>* result(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0)
# include BOOST_PP_ITERATE()

#elif BOOST_PP_ITERATION_DEPTH() == 2
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members))
# endif
// Inner over arities

# define N BOOST_PP_ITERATION()
Expand Down
11 changes: 0 additions & 11 deletions pxr/external/boost/python/detail/string_literal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# include <boost/type.hpp>
# include "pxr/external/boost/python/detail/type_traits.hpp"
# include <boost/mpl/bool.hpp>
# include <boost/detail/workaround.hpp>

namespace PXR_BOOST_NAMESPACE { namespace python { namespace detail {

Expand All @@ -36,16 +35,6 @@ struct is_string_literal<char const[n]> : mpl::true_
{
};

# if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730)
// This compiler mistakenly gets the type of string literals as char*
// instead of char[NN].
template <>
struct is_string_literal<char* const> : mpl::true_
{
};
# endif

# else

// CWPro7 has trouble with the array type deduction above
Expand Down
6 changes: 0 additions & 6 deletions pxr/external/boost/python/detail/target.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ T& (* target(R (T::*)) )() { return 0; }
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == PXR_BOOST_PYTHON_FUNCTION_POINTER
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers))
# endif

# define N BOOST_PP_ITERATION()

Expand All @@ -77,10 +74,7 @@ BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )()
# include BOOST_PP_ITERATE()

#elif BOOST_PP_ITERATION_DEPTH() == 2
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members))
# endif
// Inner over arities

# define N BOOST_PP_ITERATION()
Expand Down
Loading

0 comments on commit 2bcdfba

Please sign in to comment.