>From 3901cf0029d26b065ee253d4005f3159def92a5e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 31 Jul 2013 14:38:37 +0200 Subject: [PATCH 3/3] Remove BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENT This makes boost::config independent of boost::core in the modularized repos. --- boost/config/suffix.hpp | 66 +--------------------- boost/crc.hpp | 26 +-------- boost/math/constants/constants.hpp | 12 +--- boost/math/tools/config.hpp | 6 +- boost/mpl/has_xxx.hpp | 6 +- boost/property_map/dynamic_property_map.hpp | 2 - boost/python/type_id.hpp | 8 +-- boost/units/config.hpp | 4 -- .../html/boost_config/boost_macro_reference.html | 18 ------ libs/config/doc/macro_reference.qbk | 4 -- 10 files changed, 13 insertions(+), 139 deletions(-) diff --git a/boost/config/suffix.hpp b/boost/config/suffix.hpp index 1d9cec6..c55579e 100644 --- a/boost/config/suffix.hpp +++ b/boost/config/suffix.hpp @@ -503,69 +503,8 @@ namespace boost{ #endif // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// -// -// Some compilers have problems with function templates whose template -// parameters don't appear in the function parameter list (basically -// they just link one instantiation of the template in the final -// executable). These macros provide a uniform way to cope with the -// problem with no effects on the calling syntax. -// Example: -// -// #include -// #include -// #include -// -// template -// void f() { std::cout << n << ' '; } -// -// template -// void g() { std::cout << typeid(T).name() << ' '; } -// -// int main() { -// f<1>(); -// f<2>(); -// -// g(); -// g(); -// } -// -// With VC++ 6.0 the output is: -// -// 2 2 double double -// -// To fix it, write -// -// template -// void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... } -// -// template -// void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... } -// - - -#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && defined(__cplusplus) - -# include "boost/type.hpp" -# include "boost/non_type.hpp" - -# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type* = 0 -# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type* -# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type* = 0 -# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type* - -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ - , BOOST_EXPLICIT_TEMPLATE_TYPE(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ - , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ - , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ - , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) - -#else - -// no workaround needed: expand to nothing +// These macros are obsolete. Port away and remove. # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) @@ -577,9 +516,6 @@ namespace boost{ # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) - -#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS - // When BOOST_NO_STD_TYPEINFO is defined, we can just import // the global definition into std namespace: #if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus) diff --git a/boost/crc.hpp b/boost/crc.hpp index eb221a5..31f8375 100644 --- a/boost/crc.hpp +++ b/boost/crc.hpp @@ -60,34 +60,12 @@ #define BOOST_CRC_PARM_TYPE unsigned long #endif -// Some compilers [MS VC++ 6] cannot correctly set up several versions of a -// function template unless every template argument can be unambiguously -// deduced from the function arguments. (The bug is hidden if only one version -// is needed.) Since all of the CRC function templates have this problem, the -// workaround is to make up a dummy function argument that encodes the template -// arguments. Calls to such template functions need all their template -// arguments explicitly specified. At least one compiler that needs this -// workaround also needs the default value for the dummy argument to be -// specified in the definition. -#if defined(__GNUC__) || !defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) +// These macros are obsolete. Port away and remove. + #define BOOST_CRC_DUMMY_PARM_TYPE #define BOOST_CRC_DUMMY_INIT #define BOOST_ACRC_DUMMY_PARM_TYPE #define BOOST_ACRC_DUMMY_INIT -#else -namespace boost { namespace detail { - template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, - BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, - bool ReflectIn, bool ReflectRem > - struct dummy_crc_argument { }; -} } -#define BOOST_CRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument *p_ -#define BOOST_CRC_DUMMY_INIT BOOST_CRC_DUMMY_PARM_TYPE = 0 -#define BOOST_ACRC_DUMMY_PARM_TYPE , detail::dummy_crc_argument *p_ -#define BOOST_ACRC_DUMMY_INIT BOOST_ACRC_DUMMY_PARM_TYPE = 0 -#endif namespace boost diff --git a/boost/math/constants/constants.hpp b/boost/math/constants/constants.hpp index 6ba59ee..1601e8a 100644 --- a/boost/math/constants/constants.hpp +++ b/boost/math/constants/constants.hpp @@ -151,11 +151,7 @@ namespace boost{ namespace math { initializer() { - F( - #ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS - 0 - #endif - ); + F(); } void force_instantiate()const{} }; @@ -177,11 +173,7 @@ namespace boost{ namespace math { initializer() { - F( - #ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS - mpl::int_() , 0 - #endif - ); + F(); } void force_instantiate()const{} }; diff --git a/boost/math/tools/config.hpp b/boost/math/tools/config.hpp index 6dfb629..b77b05b 100644 --- a/boost/math/tools/config.hpp +++ b/boost/math/tools/config.hpp @@ -109,7 +109,9 @@ # define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY #endif -#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) +// FIXME: Is this obsolete? If not, why was the __SUNPRO_CC <= 0x590 case not +// in boost/config/suffix.hpp? +#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) # include "boost/type.hpp" # include "boost/non_type.hpp" @@ -143,7 +145,7 @@ # define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) -#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#endif // BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) #if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT) // Sun's compiler emits a hard error if a constant underflows, diff --git a/boost/mpl/has_xxx.hpp b/boost/mpl/has_xxx.hpp index bdca255..b44edfb 100644 --- a/boost/mpl/has_xxx.hpp +++ b/boost/mpl/has_xxx.hpp @@ -296,11 +296,7 @@ struct trait \ # endif # if !defined(BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION) -# if (defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS)) -# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 1 -# else -# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 0 -# endif +# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 0 # endif # if !defined(BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE) diff --git a/boost/property_map/dynamic_property_map.hpp b/boost/property_map/dynamic_property_map.hpp index 1726a3b..ef34773 100644 --- a/boost/property_map/dynamic_property_map.hpp +++ b/boost/property_map/dynamic_property_map.hpp @@ -299,7 +299,6 @@ put(const std::string& name, dynamic_properties& dp, const Key& key, } } -#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS template Value get(const std::string& name, const dynamic_properties& dp, const Key& key) @@ -312,7 +311,6 @@ get(const std::string& name, const dynamic_properties& dp, const Key& key) BOOST_THROW_EXCEPTION(dynamic_get_failure(name)); } -#endif template Value diff --git a/boost/python/type_id.hpp b/boost/python/type_id.hpp index 4a5727d..762a487 100644 --- a/boost/python/type_id.hpp +++ b/boost/python/type_id.hpp @@ -69,11 +69,9 @@ struct type_info : private totally_ordered base_id_t m_base_type; }; -# ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS -# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) ::boost::type* -# else -# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) -# endif + +// This macro is obsolete. Port away and remove. +# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) template inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) diff --git a/boost/units/config.hpp b/boost/units/config.hpp index 9e8a74f..3b2632b 100644 --- a/boost/units/config.hpp +++ b/boost/units/config.hpp @@ -67,10 +67,6 @@ #error Boost.Units requires function template partial ordering #endif - #ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS - #error Boost.Units requires explicit function template arguments - #endif - #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #error Boost.Units requires partial specialization #endif diff --git a/libs/config/doc/html/boost_config/boost_macro_reference.html b/libs/config/doc/html/boost_config/boost_macro_reference.html index 544d399..7b391ff 100644 --- a/libs/config/doc/html/boost_config/boost_macro_reference.html +++ b/libs/config/doc/html/boost_config/boost_macro_reference.html @@ -394,24 +394,6 @@

- BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS -

- - -

- Compiler -

- - -

- Can only use deduced template arguments when calling function template - instantiations. -

- - - - -

BOOST_NO_FUNCTION_TEMPLATE_ORDERING

diff --git a/libs/config/doc/macro_reference.qbk b/libs/config/doc/macro_reference.qbk index 76a6a96..4133fa6 100644 --- a/libs/config/doc/macro_reference.qbk +++ b/libs/config/doc/macro_reference.qbk @@ -105,10 +105,6 @@ indeed doing so may be impossible in some cases. Those libraries that do honor this will typically abort if a critical error occurs - you have been warned! ]] -[[`BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS`][Compiler][ -Can only use deduced template arguments when calling function template -instantiations. -]] [[`BOOST_NO_FUNCTION_TEMPLATE_ORDERING`][Compiler][ The compiler does not perform function template ordering or its function template ordering is incorrect. -- 1.8.1.2