From c697c1fafef16f00e4ec6a72d12eb3a43c01879a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 9 Feb 2015 19:51:54 +0100 Subject: [PATCH] cmTarget: Remove template argument workaround. Pre-C++98 compilers required that the template argument be used in the function parameters. Those compilers are no longer supported as hosts, so drop the workaround. --- Help/manual/cmake-developer.7.rst | 28 ---------------------------- Source/cmTarget.cxx | 14 +++++--------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index e18250c6a..7bffa4253 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -28,34 +28,6 @@ Some implementations have a ``std::auto_ptr`` which can not be used as a return value from a function. ``std::auto_ptr`` may not be used. Use ``cmsys::auto_ptr`` instead. -Template Parameter Defaults ---------------------------- - -On ancient compilers, C++ template must use template parameters in function -arguments. If no parameter of that type is needed, the common workaround is -to add a defaulted pointer to the type to the templated function. However, -this does not work with other ancient compilers: - -.. code-block:: c++ - - template - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType* = 0) // Wrong - { - - } - -.. code-block:: c++ - - template - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType*) // Ok - { - - } - -and invoke it with the value ``0`` explicitly in all cases. - size_t ------ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 526a923f4..1ad0d486a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4711,13 +4711,11 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const //---------------------------------------------------------------------------- template -PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop, - PropertyType *); +PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop); //---------------------------------------------------------------------------- template<> -bool getTypedProperty(cmTarget const* tgt, const std::string& prop, - bool *) +bool getTypedProperty(cmTarget const* tgt, const std::string& prop) { return tgt->GetPropertyAsBool(prop); } @@ -4725,8 +4723,7 @@ bool getTypedProperty(cmTarget const* tgt, const std::string& prop, //---------------------------------------------------------------------------- template<> const char *getTypedProperty(cmTarget const* tgt, - const std::string& prop, - const char **) + const std::string& prop) { return tgt->GetProperty(prop); } @@ -4937,8 +4934,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, CompatibleType t, PropertyType *) { - PropertyType propContent = getTypedProperty(tgt, p, - 0); + PropertyType propContent = getTypedProperty(tgt, p); const bool explicitlySet = tgt->GetProperties() .find(p) != tgt->GetProperties().end(); @@ -4991,7 +4987,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty(theTarget, - interfaceProperty, 0); + interfaceProperty); std::string reportEntry; if (ifaceIsSet)