Module Name: src
Committed By: sborrill
Date: Sat Mar 6 22:02:41 UTC 2010
Modified Files:
src/include [netbsd-5]: math.h
Log Message:
Pull up the following revisions(s) (requested by joerg in ticket #1315):
include/math.h: revision 1.51
Address PR#36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
INFINITY are constant expressions.
Use the GCC builtins if possible to implement them.
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.47.8.1 src/include/math.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/include/math.h
diff -u src/include/math.h:1.47 src/include/math.h:1.47.8.1
--- src/include/math.h:1.47 Fri Apr 25 21:20:57 2008
+++ src/include/math.h Sat Mar 6 22:02:41 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: math.h,v 1.47 2008/04/25 21:20:57 christos Exp $ */
+/* $NetBSD: math.h,v 1.47.8.1 2010/03/06 22:02:41 sborrill Exp $ */
/*
* ====================================================
@@ -59,8 +59,12 @@
* ANSI/POSIX
*/
/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VAL __builtin_huge_val()
+#else
extern const union __double_u __infinity;
#define HUGE_VAL __infinity.__val
+#endif
/*
* ISO C99
@@ -72,14 +76,21 @@
((_XOPEN_SOURCE - 0) >= 600) || \
defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VALF __builtin_huge_valf()
+#define HUGE_VALL __builtin_huge_vall()
+#else
extern const union __float_u __infinityf;
#define HUGE_VALF __infinityf.__val
extern const union __long_double_u __infinityl;
#define HUGE_VALL __infinityl.__val
+#endif
/* 7.12#4 INFINITY */
-#ifdef __INFINITY
+#if __GNUC_PREREQ__(3, 3)
+#define INFINITY __builtin_inff()
+#elif defined(__INFINITY)
#define INFINITY __INFINITY /* float constant which overflows */
#else
#define INFINITY HUGE_VALF /* positive infinity */