[PATCH] C99 initializers for sysdeps/i386/fpu/bits/mathinline.h
Jakub Jelinek
jakub@redhat.com
Mon Dec 16 10:46:00 GMT 2002
On Sun, Dec 15, 2002 at 07:31:36PM -0600, Art Haas wrote:
> Hi.
>
> This patch converts this file to C99 initializers.
>
> 2002-12-15 Art Haas <ahaas@airmail.net>
>
> * sysdeps/i386/fpu/bits/mathinline.h: Convert to C99
> initializers.
This needs to be backed out (and similarly all the changes to installed
headers which might ever be sourced in C++).
C++ only groks __extension__ union { float __f; int __i; } __u = { __f: __x };
and doesn't grok __extension__ union { float __f; int __i; } __u = { .__f = __x };
(at least ATM). But even if it was fixed in G++ 3.2 already (which it is
not), installed headers need to be usable even by way older compilers,
so it would have to be guarded by some #ifdef.
> Index: sysdeps/i386/fpu/bits/mathinline.h
> ===================================================================
> RCS file: /cvs/glibc/libc/sysdeps/i386/fpu/bits/mathinline.h,v
> retrieving revision 1.48
> diff -u -r1.48 mathinline.h
> --- sysdeps/i386/fpu/bits/mathinline.h 6 Jul 2001 04:55:53 -0000 1.48
> +++ sysdeps/i386/fpu/bits/mathinline.h 16 Dec 2002 01:29:58 -0000
> @@ -127,19 +127,19 @@
> __MATH_INLINE int
> __signbitf (float __x) __THROW
> {
> - __extension__ union { float __f; int __i; } __u = { __f: __x };
> + __extension__ union { float __f; int __i; } __u = { .__f = __x };
> return __u.__i < 0;
> }
> __MATH_INLINE int
> __signbit (double __x) __THROW
> {
> - __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
> + __extension__ union { double __d; int __i[2]; } __u = { .__d = __x };
> return __u.__i[1] < 0;
> }
> __MATH_INLINE int
> __signbitl (long double __x) __THROW
> {
> - __extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
> + __extension__ union { long double __l; int __i[3]; } __u = { .__l = __x };
> return (__u.__i[2] & 0x8000) != 0;
> }
> # endif
> @@ -467,7 +467,7 @@
>
> __inline_mathcode_ (long double, __sgn1l, __x, \
> __extension__ union { long double __xld; unsigned int __xi[3]; } __n = \
> - { __xld: __x }; \
> + { .__xld = __x }; \
> __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; \
> __n.__xi[1] = 0x80000000; \
> __n.__xi[0] = 0; \
> @@ -666,7 +666,7 @@
> __finite (double __x) __THROW
> {
> return (__extension__
> - (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
> + (((((union { double __d; int __i[2]; }) {.__d = __x}).__i[1]
> | 0x800fffffu) + 1) >> 31));
> }
>
Jakub
More information about the Libc-alpha
mailing list