[cfe-commits] r151276 - /cfe/trunk/lib/Headers/tgmath.h

Howard Hinnant hhinnant at apple.com
Thu Feb 23 12:22:10 PST 2012


Author: hhinnant
Date: Thu Feb 23 14:22:10 2012
New Revision: 151276

URL: http://llvm.org/viewvc/llvm-project?rev=151276&view=rev
Log:
* tgmath_logb.patch implements the missing logb function (see C99 standard 7.22, paragraph 5). * tgmath_fabs_complex.patch corrects the return types for the complex fabs functions. These must be non-complex float/double/long double (see C99 standard 7.22, paragraph 4 and 7.3.8.1).  Patch contributed by Kristof Beyls.

Modified:
    cfe/trunk/lib/Headers/tgmath.h

Modified: cfe/trunk/lib/Headers/tgmath.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/tgmath.h?rev=151276&r1=151275&r2=151276&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/tgmath.h (original)
+++ cfe/trunk/lib/Headers/tgmath.h Thu Feb 23 14:22:10 2012
@@ -540,15 +540,15 @@
     _TG_ATTRS
     __tg_fabs(long double __x) {return fabsl(__x);}
 
-static float _Complex
+static float
     _TG_ATTRS
     __tg_fabs(float _Complex __x) {return cabsf(__x);}
 
-static double _Complex
+static double
     _TG_ATTRS
     __tg_fabs(double _Complex __x) {return cabs(__x);}
 
-static long double _Complex
+static long double
     _TG_ATTRS
     __tg_fabs(long double _Complex __x) {return cabsl(__x);}
 
@@ -976,6 +976,23 @@
 #undef log2
 #define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
 
+// logb
+
+static float
+    _TG_ATTRS
+    __tg_logb(float __x) {return logbf(__x);}
+
+static double
+    _TG_ATTRS
+    __tg_logb(double __x) {return logb(__x);}
+
+static long double
+    _TG_ATTRS
+    __tg_logb(long double __x) {return logbl(__x);}
+
+#undef logb
+#define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
+
 // lrint
 
 static long





More information about the cfe-commits mailing list