[PATCH] Math special functions testsuite cleanup

Jonathan Wakely jwakely@redhat.com
Wed Aug 3 07:36:00 GMT 2016


On 02/08/16 22:53 -0400, Ed Smith-Rowland wrote:
>On 08/02/2016 09:33 AM, Jonathan Wakely wrote:
>>On 02/08/16 14:31 +0100, Jonathan Wakely wrote:
>>>This latest set of patches for the testsuite are for the maths special
>>>functions.
>>>
>>>This test for <tr1/cmath> was defining __STDCPP_WANT_MATH_SPEC_FUNCS__
>>>so it was testing the functions in namespace std, not std::tr1. I
>>>assume that's just a mistake (Ed?) and so have removed it. This allows
>>>the test to be run with -std=gnu++98:
>>>
>>>  Test TR1 special functions without adding them to std
>>>      * 
>>>testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/
>>>      check_value.cc: Do not add special functions to namespace 
>>>std in TR1
>>>      test.
>>
>>I forgot to CC Ed for this question
>Yes, that's a mistake.
>It was needed in both std and std::tr1.
>This was a paste-o.

Cool, thanks for confirming.

Later today I'm going to commit a patch based on this, to enable the
special functions unconditionally for C++17:

--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -532,6 +532,13 @@ namespace std
 #define _GLIBCXX_TXN_SAFE_DYN
 #endif
 
+#if __cplusplus > 201402L
+// In C++17 mathematical special functions are in namespace std.
+# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
+#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
+// For C++11 and C++14 they are in namespace std when requested.
+# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
+#endif
 
 // The remainder of the prewritten config is automatic; all the
 // user hooks are listed above.
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 6a24ebf..6db9dee 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1790,7 +1790,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 #endif // C++11
 
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
 #  include <bits/specfun.h>
 #endif
 



More information about the Libstdc++ mailing list