[libcxx] r232641 - Provide std::abs(<floating-point>) in <cmath> on Solaris.

Eric Fiselier eric at efcs.ca
Wed Mar 18 08:24:18 PDT 2015

Author: ericwf
Date: Wed Mar 18 10:24:18 2015
New Revision: 232641

URL: http://llvm.org/viewvc/llvm-project?rev=232641&view=rev
Provide std::abs(<floating-point>) in <cmath> on Solaris.

1) <cstdlib> header should define std::abs([int|long|long long])
functions. They use "using ::abs" to import these functions (which are
declared in <stdlib.h>) into std namespace.
2) <cmath> header should define std::abs([float|double|long double])
function. If we try define new functions in std namespace, then it
will cause compile error in <cstdlib> because "using ::abs" will try
import not only [int|long|long long] functions, but also
[float|double|long double] which are defined in <math.h> header on

Patch by C Bergstrom.


Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=232641&r1=232640&r2=232641&view=diff
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Wed Mar 18 10:24:18 2015
@@ -654,6 +654,10 @@ using ::double_t;
 // abs
+#if defined(__sun__)
+using ::abs;
 #if !defined(_AIX) && !defined(__sun__)

More information about the cfe-commits mailing list