summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-05 03:24:47 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-05 03:24:47 +0000
commit9522ae94dc821afd31f92d08dfcdf55cf265b4d6 (patch)
treee80f2ef396b8f30297bb4fb5fbc78325b9ca2a64 /libc/sysdeps/linux/common/bits
parenta27d6f22eb595f7de231d785b21aed8a8d747c72 (diff)
sync Joseph S. Myers fixes from glibc for a better NAN define
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r--libc/sysdeps/linux/common/bits/nan.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/bits/nan.h b/libc/sysdeps/linux/common/bits/nan.h
index 6d88b551b..bae97f216 100644
--- a/libc/sysdeps/linux/common/bits/nan.h
+++ b/libc/sysdeps/linux/common/bits/nan.h
@@ -1,5 +1,5 @@
/* `NAN' constant for IEEE 754 machines.
- Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,11 +24,15 @@
/* IEEE Not A Number. */
-#ifdef __GNUC__
+#if __GNUC_PREREQ(3,3)
+
+# define NAN (__builtin_nanf (""))
+
+#elif defined __GNUC__
# define NAN \
- (__extension__ \
- ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
+ (__extension__ \
+ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
{ __l: 0x7fc00000UL }).__d)
#else
@@ -42,7 +46,8 @@
# define __nan_bytes { 0, 0, 0xc0, 0x7f }
# endif
-static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
+static union { unsigned char __c[4]; float __d; } __nan_union
+ __attribute_used__ = { __nan_bytes };
# define NAN (__nan_union.__d)
#endif /* GCC. */