This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

V3 PATCH: Fix declaration of `abs'



Due to a typo, the V3 headers tried to declare:

  extern "C" abs(double);

on systems that don't have __builtin_fabs, like Solaris.  That doesn't
work very well, since that function is called `fabs'.

I moved the definition of the overloaded `abs(double)' to be after the
definition of `fabs'; then we can just use it.  Gaby, take a look and
make sure I am still clinging to vestiges of sanity...

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-11-12  Mark Mitchell  <mark@codesourcery.com>

	* include/c/bits/std_cmath.h (abs): Change extern "C" declaration
	of `abs (double)' to ...
	(fabs): this.

Index: std_cmath.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/c/bits/std_cmath.h,v
retrieving revision 1.5
diff -c -p -r1.5 std_cmath.h
*** std_cmath.h	2000/10/31 01:26:05	1.5
--- std_cmath.h	2000/11/13 00:42:08
*************** namespace std 
*** 263,275 ****
  #endif
  
  
- #if _GLIBCPP_HAVE___BUILTIN_FABS
-   inline double 
-   abs(double __x) { return __builtin_fabs(__x); }
- #else
-   extern "C" double abs(double __x);
- #endif
- 
    extern "C" double acos(double __x);
  
    extern "C" double asin(double __x);
--- 263,268 ----
*************** namespace std 
*** 296,301 ****
--- 289,302 ----
    fabs(double __x) { return __builtin_fabs(__x); }
  #else
    extern "C" double fabs(double __x);
+ #endif
+ 
+ #if _GLIBCPP_HAVE___BUILTIN_FABS
+   inline double 
+   abs(double __x) { return __builtin_fabs(__x); }
+ #else
+   inline double
+   abs(double __x) { return fabs (__x); }
  #endif
  
    extern "C" double floor(double __x);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]