Add C++ special math functions to C++17

Ed Smith-Rowland 3dw4rd@verizon.net
Thu Mar 10 15:28:00 GMT 2016


On 03/10/2016 05:24 AM, Tobias Burnus wrote:
> Ed Smith-Rowland wrote:
>> --- include/bits/specfun.h	(svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include)	(working copy)
>> +++ svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include	(revision 234098)
>> @@ -1,6 +1,6 @@
>>   // Mathematical Special Functions for -*- C++ -*-
>>   
>> -// Copyright (C) 2006-2016 Free Software Foundation, Inc.
>> +// Copyright (C) 2006-2015 Free Software Foundation, Inc.
> The patch looks reversed ("---" for the "working copy", copyright-year change reversed etc.)
>
> Cheers,
>
> Tobias
>
Third time's a charm.
(I accidentally checked these into my branch along with a general merge 
from trunk - hence my issues)

-------------- next part --------------
2016-03-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Pull C++ Special Math into std for C++17.
	* include/bits/specfun.h: Allow special functions for C++17;
	define __cpp_lib_math_special_functions.
	* include/c_global/cmath: Allow special functions for C++17.
	* include/c_compatibility/math.h: Ditto

-------------- next part --------------
Index: include/bits/specfun.h
===================================================================
--- include/bits/specfun.h	(svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include)	(revision 234110)
+++ include/bits/specfun.h	(.../include)	(working copy)
@@ -1,6 +1,6 @@
 // Mathematical Special Functions for -*- C++ -*-
 
-// Copyright (C) 2006-2015 Free Software Foundation, Inc.
+// Copyright (C) 2006-2016 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -34,15 +34,21 @@
 
 #include <bits/c++config.h>
 
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
+#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
+
+#define __cpp_lib_math_special_functions 201603L
+
+#if __cplusplus <= 201402L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
 # error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__
 #endif
 
-#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
-
+#include <limits>
 #include <bits/stl_algobase.h>
-#include <limits>
-#include <type_traits>
+#if __cplusplus >= 201103L
+#  include <type_traits>
+#else
+#  include <tr1/type_traits>
+#endif
 
 #include <tr1/gamma.tcc>
 #include <tr1/bessel_function.tcc>
Index: include/c_global/cmath
===================================================================
--- include/c_global/cmath	(svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include)	(revision 234110)
+++ include/c_global/cmath	(.../include)	(working copy)
@@ -1790,7 +1790,7 @@
 
 #endif // C++11
 
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if __cplusplus > 201402L || __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
 #  include <bits/specfun.h>
 #endif
 
Index: include/c_compatibility/math.h
===================================================================
--- include/c_compatibility/math.h	(svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include)	(revision 234110)
+++ include/c_compatibility/math.h	(.../include)	(working copy)
@@ -111,7 +111,7 @@
 using std::trunc;
 #endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1
 
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if __cplusplus > 201402L || __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
 using std::assoc_laguerref;
 using std::assoc_laguerrel;
 using std::assoc_laguerre;


More information about the Libstdc++ mailing list