From 7782d0bf55c294b7ed872e2590fcf4a683be5e05 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 1 Oct 1998 11:00:26 +0000 Subject: [PATCH] Update. * sys/types.h: Protect use of long long by __extension__. * stdlib/stdlib.h: Likewise. * string/string.h: Likewise. * sysdeps/i386/bits/byteswap.h: Likewise. * sysdeps/geeric/bits/byteswap.h: Likewise. * sysdeps/i386/fpu/bits/mathinline.h: Likewise. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. * sysdeps/wordsize-32/inttypes.h: Likewise. * sysdeps/wordsize-32/stdint.h: Likewise. * wcsmbs/wchar.h: Likewise. --- ChangeLog | 12 ++++++ bits/byteswap.h | 13 +++--- posix/sys/types.h | 4 +- stdlib/stdlib.h | 27 ++++++++---- string/string.h | 3 +- sysdeps/generic/bits/byteswap.h | 13 +++--- sysdeps/i386/bits/byteswap.h | 72 ++++++++++++++++--------------- sysdeps/i386/fpu/bits/mathinline.h | 4 +- sysdeps/unix/sysv/linux/bits/types.h | 8 ++-- sysdeps/unix/sysv/linux/mips/bits/types.h | 8 ++-- sysdeps/wordsize-32/inttypes.h | 4 ++ sysdeps/wordsize-32/stdint.h | 10 ++++- wcsmbs/wchar.h | 10 +++++ 13 files changed, 118 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4df7ad5770..6cf365abd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,18 @@ * timezone/europe: Update from tzdata1998i. * timezone/southamerica: Likewise. + * sys/types.h: Protect use of long long by __extension__. + * stdlib/stdlib.h: Likewise. + * string/string.h: Likewise. + * sysdeps/i386/bits/byteswap.h: Likewise. + * sysdeps/geeric/bits/byteswap.h: Likewise. + * sysdeps/i386/fpu/bits/mathinline.h: Likewise. + * sysdeps/unix/sysv/linux/bits/types.h: Likewise. + * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. + * sysdeps/wordsize-32/inttypes.h: Likewise. + * sysdeps/wordsize-32/stdint.h: Likewise. + * wcsmbs/wchar.h: Likewise. + 1998-09-29 Andreas Schwab * string/bits/string2.h (__string2_1bptr_p): Don't use a statement diff --git a/bits/byteswap.h b/bits/byteswap.h index a5dd4a7db3..73189cfe5c 100644 --- a/bits/byteswap.h +++ b/bits/byteswap.h @@ -54,10 +54,11 @@ __bswap32 (unsigned int x) #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_64(x) \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __v, __r; \ - __v.__ll = (x); \ - __r.__l[0] = __bswap_32 (__v.__l[1]); \ - __r.__l[1] = __bswap_32 (__v.__l[0]); \ - __r.__ll; }) + (__extension__ \ + ({ union { unsigned long long int __ll; \ + unsigned long int __l[2]; } __v, __r; \ + __v.__ll = (x); \ + __r.__l[0] = __bswap_32 (__v.__l[1]); \ + __r.__l[1] = __bswap_32 (__v.__l[0]); \ + __r.__ll; })) #endif diff --git a/posix/sys/types.h b/posix/sys/types.h index 936b738621..b0246a2531 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -141,7 +141,7 @@ typedef char int8_t; typedef short int int16_t; typedef int int32_t; # ifdef __GNUC__ -typedef long long int int64_t; +__extension__ typedef long long int int64_t; # endif # endif @@ -150,7 +150,7 @@ typedef unsigned char u_int8_t; typedef unsigned short int u_int16_t; typedef unsigned int u_int32_t; # ifdef __GNUC__ -typedef unsigned long long int u_int64_t; +__extension__ typedef unsigned long long int u_int64_t; # endif typedef int register_t; diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index e577fb7245..72a91af894 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -53,7 +53,7 @@ typedef struct #ifdef __USE_ISOC9X /* Returned by `lldiv'. */ -typedef struct +__extension__ typedef struct { long long int quot; /* Quotient. */ long long int rem; /* Remainder. */ @@ -85,7 +85,7 @@ extern long int atol __P ((__const char *__nptr)); #if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_MISC) /* These functions will part of the standard C library in ISO C 9X. */ -extern long long int atoll __P ((__const char *__nptr)); +__extension__ extern long long int atoll __P ((__const char *__nptr)); #endif /* Convert a string to a floating-point number. */ @@ -111,9 +111,11 @@ extern unsigned long int strtoul __P ((__const char *__restrict __nptr, #if defined __GNUC__ && defined __USE_BSD /* Convert a string to a quadword integer. */ +__extension__ extern long long int strtoq __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); /* Convert a string to an unsigned quadword integer. */ +__extension__ extern unsigned long long int strtouq __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); @@ -123,9 +125,11 @@ extern unsigned long long int strtouq __P ((__const char *__restrict __nptr, /* These functions will part of the standard C library in ISO C 9X. */ /* Convert a string to a quadword integer. */ +__extension__ extern long long int strtoll __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); /* Convert a string to an unsigned quadword integer. */ +__extension__ extern unsigned long long int strtoull __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base)); @@ -158,10 +162,12 @@ extern unsigned long int __strtoul_l __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc)); +__extension__ extern long long int __strtoll_l __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc)); +__extension__ extern unsigned long long int __strtoull_l __P ((__const char *__restrict __nptr, char **__restrict __endptr, @@ -207,12 +213,14 @@ extern unsigned long int __strtoul_internal __P ((__const char * #endif #if defined __GNUC__ || defined __USE_ISOC9X # ifndef __strtoll_internal_defined +__extension__ extern long long int __strtoll_internal __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group)); # define __strtoll_internal_defined 1 # endif # ifndef __strtoull_internal_defined +__extension__ extern unsigned long long int __strtoull_internal __P ((__const char * __restrict __nptr, char ** @@ -259,13 +267,13 @@ strtold (__const char *__restrict __nptr, char **__restrict __endptr) # endif # ifdef __USE_BSD -extern __inline long long int +__extension__ extern __inline long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) { return __strtoll_internal (__nptr, __endptr, __base, 0); } -extern __inline unsigned long long int +__extension__ extern __inline unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) { @@ -274,13 +282,13 @@ strtouq (__const char *__restrict __nptr, char **__restrict __endptr, # endif # if defined __USE_MISC || defined __USE_ISOC9X -extern __inline long long int +__extension__ extern __inline long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) { return __strtoll_internal (__nptr, __endptr, __base, 0); } -extern __inline unsigned long long int +__extension__ extern __inline unsigned long long int strtoull (__const char * __restrict __nptr, char **__restrict __endptr, int __base) { @@ -305,7 +313,7 @@ atol (__const char *__nptr) } # if defined __USE_MISC || defined __USE_ISOC9X -extern __inline long long int +__extension__ extern __inline long long int atoll (__const char *__nptr) { return strtoll (__nptr, (char **) NULL, 10); @@ -594,7 +602,7 @@ extern void qsort __PMT ((__ptr_t __base, size_t __nmemb, size_t __size, extern int abs __P ((int __x)) __attribute__ ((__const__)); extern long int labs __P ((long int __x)) __attribute__ ((__const__)); #ifdef __USE_ISOC9X -extern long long int llabs __P ((long long int __x)) +__extension__ extern long long int llabs __P ((long long int __x)) __attribute__ ((__const__)); #endif @@ -606,7 +614,8 @@ extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__)); extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__)); #ifdef __USE_ISOC9X -extern lldiv_t lldiv __P ((long long int __numer, long long int __denom)) +__extension__ extern lldiv_t lldiv __P ((long long int __numer, + long long int __denom)) __attribute__ ((__const__)); #endif diff --git a/string/string.h b/string/string.h index 9226850640..5ded08f58b 100644 --- a/string/string.h +++ b/string/string.h @@ -239,7 +239,8 @@ extern int ffs __P ((int __i)) __attribute__ ((const)); # ifdef __USE_GNU extern int ffsl __P ((long int __l)) __attribute__ ((const)); # ifdef __GNUC__ -extern int ffsll __P ((long long int __ll)) __attribute__ ((const)); +__extension__ extern int ffsll __P ((long long int __ll)) + __attribute__ ((const)); # endif # endif diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h index a5dd4a7db3..73189cfe5c 100644 --- a/sysdeps/generic/bits/byteswap.h +++ b/sysdeps/generic/bits/byteswap.h @@ -54,10 +54,11 @@ __bswap32 (unsigned int x) #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_64(x) \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __v, __r; \ - __v.__ll = (x); \ - __r.__l[0] = __bswap_32 (__v.__l[1]); \ - __r.__l[1] = __bswap_32 (__v.__l[0]); \ - __r.__ll; }) + (__extension__ \ + ({ union { unsigned long long int __ll; \ + unsigned long int __l[2]; } __v, __r; \ + __v.__ll = (x); \ + __r.__l[0] = __bswap_32 (__v.__l[1]); \ + __r.__l[1] = __bswap_32 (__v.__l[0]); \ + __r.__ll; })) #endif diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h index 760e0751c9..a1ba6b8748 100644 --- a/sysdeps/i386/bits/byteswap.h +++ b/sysdeps/i386/bits/byteswap.h @@ -27,15 +27,16 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __bswap_16(x) \ - ({ register unsigned short int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_16 (x); \ - else \ - __asm__ __volatile__ ("rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((unsigned short int) (x)) \ - : "cc"); \ - __v; }) + (__extension__ \ + ({ register unsigned short int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_16 (x); \ + else \ + __asm__ __volatile__ ("rorw $8, %w0" \ + : "=r" (__v) \ + : "0" ((unsigned short int) (x)) \ + : "cc"); \ + __v; })) #else /* This is better than nothing. */ # define __bswap_16(x) __bswap_constant_16 (x) @@ -52,27 +53,29 @@ `bswap' opcode. On i386 we have to use three instructions. */ # if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ # define __bswap_32(x) \ - ({ register unsigned int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ - else \ - __asm__ __volatile__ ("rorw $8, %w0;" \ - "rorl $16, %0;" \ - "rorw $8, %w0" \ - : "=r" (__v) \ - : "0" ((unsigned int) (x)) \ - : "cc"); \ - __v; }) + (__extension__ \ + ({ register unsigned int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_32 (x); \ + else \ + __asm__ __volatile__ ("rorw $8, %w0;" \ + "rorl $16, %0;" \ + "rorw $8, %w0" \ + : "=r" (__v) \ + : "0" ((unsigned int) (x)) \ + : "cc"); \ + __v; })) # else # define __bswap_32(x) \ - ({ register unsigned int __v; \ - if (__builtin_constant_p (x)) \ - __v = __bswap_constant_32 (x); \ - else \ - __asm__ __volatile__ ("bswap %0" \ - : "=r" (__v) \ - : "0" ((unsigned int) (x))); \ - __v; }) + (__extension__ \ + ({ register unsigned int __v; \ + if (__builtin_constant_p (x)) \ + __v = __bswap_constant_32 (x); \ + else \ + __asm__ __volatile__ ("bswap %0" \ + : "=r" (__v) \ + : "0" ((unsigned int) (x))); \ + __v; })) # endif #else # define __bswap_32(x) __bswap_constant_32 (x) @@ -82,10 +85,11 @@ #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_64(x) \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __w, __r; \ - __w.__ll = (x); \ - __r.__l[0] = __bswap_32 (__w.__l[1]); \ - __r.__l[1] = __bswap_32 (__w.__l[0]); \ - __r.__ll; }) + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned long int __l[2]; } __w, __r; \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + __r.__ll; })) #endif diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index b188026cdb..bf5b99a00e 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -231,7 +231,7 @@ __inline_mathcode (__sgn, __x, \ __inline_mathcode (__pow2, __x, \ register long double __value; \ register long double __exponent; \ - long long int __p = (long long int) __x; \ + __extension__ long long int __p = (long long int) __x; \ if (__x == (long double) __p) \ { \ __asm __volatile__ \ @@ -376,7 +376,7 @@ __inline_mathcode2 (fmod, __x, __y, \ __inline_mathcode2 (pow, __x, __y, \ register long double __value; \ register long double __exponent; \ - long long int __p = (long long int) __y; \ + __extension__ long long int __p = (long long int) __y; \ if (__x == 0.0 && __y > 0.0) \ return 0.0; \ if (__y == (double) __p) \ diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h index 30dc5e20e0..06206f3b55 100644 --- a/sysdeps/unix/sysv/linux/bits/types.h +++ b/sysdeps/unix/sysv/linux/bits/types.h @@ -34,8 +34,8 @@ typedef unsigned short __u_short; typedef unsigned int __u_int; typedef unsigned long __u_long; #ifdef __GNUC__ -typedef unsigned long long int __u_quad_t; -typedef long long int __quad_t; +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; #else typedef struct { @@ -53,8 +53,8 @@ typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; #ifdef __GNUC__ -typedef signed long long int __int64_t; -typedef unsigned long long int __uint64_t; +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; #endif typedef __quad_t *__qaddr_t; diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h index 2bb8a2a9c6..c716d5735d 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types.h @@ -34,8 +34,8 @@ typedef unsigned short __u_short; typedef unsigned int __u_int; typedef unsigned long __u_long; #ifdef __GNUC__ -typedef unsigned long long int __u_quad_t; -typedef long long int __quad_t; +__extension__ typedef unsigned long long int __u_quad_t; +__extension__ typedef long long int __quad_t; #else typedef struct { @@ -53,8 +53,8 @@ typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; #ifdef __GNUC__ -typedef signed long long int __int64_t; -typedef unsigned long long int __uint64_t; +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; #endif typedef __quad_t *__qaddr_t; diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h index 250cbe31dd..6144411e24 100644 --- a/sysdeps/wordsize-32/inttypes.h +++ b/sysdeps/wordsize-32/inttypes.h @@ -271,6 +271,7 @@ extern uintmax_t wcstoumax __P ((__const wchar_t * __restrict __nptr, /* Like `strtol' but convert to `intmax_t'. */ # ifndef __strtoll_internal_defined +__extension__ extern long long int __strtoll_internal __P ((__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group)); @@ -284,6 +285,7 @@ strtoimax (__const char *__restrict nptr, char **__restrict endptr, int base) /* Like `strtoul' but convert to `uintmax_t'. */ # ifndef __strtoull_internal_defined +__extension__ extern unsigned long long int __strtoull_internal __P ((__const char * __restrict __nptr, char ** @@ -300,6 +302,7 @@ strtoumax (__const char *__restrict nptr, char **__restrict endptr, int base) /* Like `wcstol' but convert to `intmax_t'. */ # ifndef __wcstoll_internal_defined +__extension__ extern long long int __wcstoll_internal __P ((__const wchar_t * __restrict __nptr, wchar_t **__restrict __endptr, @@ -316,6 +319,7 @@ wcstoimax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, /* Like `wcstoul' but convert to `uintmax_t'. */ # ifndef __wcstoull_internal_defined +__extension__ extern unsigned long long int __wcstoull_internal __P ((__const wchar_t * __restrict __nptr, wchar_t ** diff --git a/sysdeps/wordsize-32/stdint.h b/sysdeps/wordsize-32/stdint.h index 2f693e81ff..ef3de98620 100644 --- a/sysdeps/wordsize-32/stdint.h +++ b/sysdeps/wordsize-32/stdint.h @@ -37,6 +37,7 @@ typedef signed char int8_t; typedef short int int16_t; typedef int int32_t; +__extension__ typedef long long int int64_t; #endif @@ -44,6 +45,7 @@ typedef long long int int64_t; typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; +__extension__ typedef unsigned long long int uint64_t; @@ -53,12 +55,14 @@ typedef unsigned long long int uint64_t; typedef signed char int_least8_t; typedef short int int_least16_t; typedef int int_least32_t; +__extension__ typedef long long int int_least64_t; /* Unsigned. */ typedef unsigned char uint_least8_t; typedef unsigned short int uint_least16_t; typedef unsigned int uint_least32_t; +__extension__ typedef unsigned long long int uint_least64_t; @@ -68,12 +72,14 @@ typedef unsigned long long int uint_least64_t; typedef signed char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; +__extension__ typedef long long int int_fast64_t; /* Unsigned. */ typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; +__extension__ typedef unsigned long long int uint_fast64_t; @@ -86,8 +92,8 @@ typedef unsigned int uintptr_t; /* Largest integral types. */ -typedef long long int intmax_t; -typedef unsigned long long int uintmax_t; +__extension__ typedef long long int intmax_t; +__extension__ typedef unsigned long long int uintmax_t; /* The ISO C 9X standard specifies that these macros must only be diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 0bd50f7c60..14da7a1913 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -310,11 +310,13 @@ extern unsigned long int wcstoul __P ((__const wchar_t *__restrict __nptr, #if defined __GNUC__ && defined __USE_GNU /* Convert initial portion of wide string NPTR to `long int' representation. */ +__extension__ extern long long int wcstoq __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)); /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ +__extension__ extern unsigned long long int wcstouq __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)); @@ -323,11 +325,13 @@ extern unsigned long long int wcstouq __P ((__const wchar_t *__restrict __nptr, #if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_GNU) /* Convert initial portion of wide string NPTR to `long int' representation. */ +__extension__ extern long long int wcstoll __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base)); /* Convert initial portion of wide string NPTR to `unsigned long long int' representation. */ +__extension__ extern unsigned long long int wcstoull __P ((__const wchar_t * __restrict __nptr, wchar_t **__restrict __endptr, @@ -360,10 +364,12 @@ extern unsigned long int __wcstoul_l __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc)); +__extension__ extern long long int __wcstoll_l __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base, __locale_t __loc)); +__extension__ extern unsigned long long int __wcstoull_l __P ((__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, @@ -412,6 +418,7 @@ extern unsigned long int __wcstoul_internal __P ((__const wchar_t * # define __wcstoul_internal_defined 1 #endif #ifndef __wcstoll_internal_defined +__extension__ extern long long int __wcstoll_internal __P ((__const wchar_t * __restrict __nptr, wchar_t **__restrict __endptr, @@ -419,6 +426,7 @@ extern long long int __wcstoll_internal __P ((__const wchar_t * # define __wcstoll_internal_defined 1 #endif #ifndef __wcstoull_internal_defined +__extension__ extern unsigned long long int __wcstoull_internal __P ((__const wchar_t * __restrict __nptr, wchar_t ** @@ -452,10 +460,12 @@ extern __inline __long_double_t wcstold (__const wchar_t *__restrict __nptr, { return __wcstold_internal (__nptr, __endptr, 0); } +__extension__ extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr, wchar_t **__restrict __endptr, int __base) { return __wcstoll_internal (__nptr, __endptr, __base, 0); } +__extension__ extern __inline unsigned long long int wcstouq (__const wchar_t * __restrict __nptr, wchar_t **__restrict __endptr, -- 2.11.4.GIT