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

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


On 03/10/2016 03:48 AM, Jakub Jelinek wrote:
> On Thu, Mar 10, 2016 at 03:44:26AM -0500, Ed Smith-Rowland wrote:
>> Here is a small patch to allow the special maths functions that came in with
>> TR29124 into C++17 in Jacksonville.
>> I am leaving the TR29124 access with __STDCPP_WANT_MATH_SPEC_FUNCS__ for C++
>> < 17.
>>
>> I added the SD-6 feature macro:
>> #define __cpp_lib_math_special_functions 20163L
>>
>> Passes testing on x86-64-linux.
>>
>> OK?
> ENOPATCH ;)
>
> 	Jakub
>
Arrgh!

-------------- 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)	(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.
 //
 // 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,21 +34,15 @@
 
 #include <bits/c++config.h>
 
-#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
-
-#define __cpp_lib_math_special_functions 201603L
-
-#if __cplusplus <= 201402L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
+#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
 # error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__
 #endif
 
+#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
+
+#include <bits/stl_algobase.h>
 #include <limits>
-#include <bits/stl_algobase.h>
-#if __cplusplus >= 201103L
-#  include <type_traits>
-#else
-#  include <tr1/type_traits>
-#endif
+#include <type_traits>
 
 #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)	(working copy)
+++ svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include	(revision 234098)
@@ -1790,7 +1790,7 @@
 
 #endif // C++11
 
-#if __cplusplus > 201402L || __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if __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)	(working copy)
+++ svn+ssh://emsr@gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/include	(revision 234098)
@@ -111,7 +111,7 @@
 using std::trunc;
 #endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1
 
-#if __cplusplus > 201402L || __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
 using std::assoc_laguerref;
 using std::assoc_laguerrel;
 using std::assoc_laguerre;


More information about the Gcc-patches mailing list