diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-12-23 13:52:59 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-12-23 13:52:59 -0500 |
commit | 67371b5666310a0012ec39b6c9bc41fe0c1b0bc4 (patch) | |
tree | 6059d358471785cc7223dd2a11e87584211824e0 | |
parent | bbe315ea364e86166bb985e2e605af029482a124 (diff) | |
download | glibc-67371b5666310a0012ec39b6c9bc41fe0c1b0bc4.tar.gz glibc-67371b5666310a0012ec39b6c9bc41fe0c1b0bc4.tar.xz glibc-67371b5666310a0012ec39b6c9bc41fe0c1b0bc4.zip |
Prevent warnings due to long long constants
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | bits/byteswap.h | 21 | ||||
-rw-r--r-- | sysdeps/i386/bits/byteswap.h | 20 | ||||
-rw-r--r-- | sysdeps/ia64/bits/byteswap.h | 35 | ||||
-rw-r--r-- | sysdeps/s390/bits/byteswap.h | 112 | ||||
-rw-r--r-- | sysdeps/x86_64/bits/byteswap.h | 18 |
6 files changed, 124 insertions, 90 deletions
diff --git a/ChangeLog b/ChangeLog index 37e70e712c..2f2a22e12c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-12-23 Ulrich Drepper <drepper@gmail.com> + + * bits/byteswap.h: Protect long long constants with __extension__. + * sysdeps/i386/bits/byteswap.h: Likewise. + * sysdeps/ia64/bits/byteswap.h: Likewise. + * sysdeps/s390/bits/byteswap.h: Likewise. + * sysdeps/x86_64/bits/byteswap.h: Likewise. + 2011-12-23 Liubov Dmitrieva <liubov.dmitrieva@gmail.com> [BZ #13540] diff --git a/bits/byteswap.h b/bits/byteswap.h index 45cb9471e3..6df2f28c02 100644 --- a/bits/byteswap.h +++ b/bits/byteswap.h @@ -1,5 +1,6 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997,1998,2000-2002,2005,2008 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000-2002,2005,2008,2011 + 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 @@ -60,20 +61,20 @@ __bswap_32 (unsigned int __bsx) #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) + (__extension__ ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56))) # define __bswap_64(x) \ (__extension__ \ ({ union { __extension__ unsigned long long int __ll; \ unsigned int __l[2]; } __w, __r; \ - if (__builtin_constant_p (x)) \ + if (__builtin_constant_p (x)) \ __r.__ll = __bswap_constant_64 (x); \ else \ { \ diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h index c246ae86c6..ddfb785c6e 100644 --- a/sysdeps/i386/bits/byteswap.h +++ b/sysdeps/i386/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010 + Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -109,15 +109,15 @@ __bswap_32 (unsigned int __bsx) #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ -#define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) +# define __bswap_constant_64(x) \ + (__extension__ ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56))) # define __bswap_64(x) \ (__extension__ \ diff --git a/sysdeps/ia64/bits/byteswap.h b/sysdeps/ia64/bits/byteswap.h index d64914f36e..29d0e37d12 100644 --- a/sysdeps/ia64/bits/byteswap.h +++ b/sysdeps/ia64/bits/byteswap.h @@ -1,5 +1,6 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997,1998,2000,2002,2003,2008 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2002,2003,2008,2011 + 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 @@ -77,17 +78,17 @@ __bswap_32 (unsigned int __bsx) /* Swap bytes in 64 bit value. */ -#define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ul) >> 56) \ - | (((x) & 0x00ff000000000000ul) >> 40) \ - | (((x) & 0x0000ff0000000000ul) >> 24) \ - | (((x) & 0x000000ff00000000ul) >> 8) \ - | (((x) & 0x00000000ff000000ul) << 8) \ - | (((x) & 0x0000000000ff0000ul) << 24) \ - | (((x) & 0x000000000000ff00ul) << 40) \ - | (((x) & 0x00000000000000fful) << 56)) - #if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_constant_64(x) \ + (__extension__ ((((x) & 0xff00000000000000ul) >> 56) \ + | (((x) & 0x00ff000000000000ul) >> 40) \ + | (((x) & 0x0000ff0000000000ul) >> 24) \ + | (((x) & 0x000000ff00000000ul) >> 8) \ + | (((x) & 0x00000000ff000000ul) << 8) \ + | (((x) & 0x0000000000ff0000ul) << 24) \ + | (((x) & 0x000000000000ff00ul) << 40) \ + | (((x) & 0x00000000000000fful) << 56))) + # define __bswap_64(x) \ (__extension__ \ ({ register unsigned long int __v, __x = (x); \ @@ -97,9 +98,19 @@ __bswap_32 (unsigned int __bsx) __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \ : "=r" (__v) \ : "r" ((unsigned long int) (__x))); \ - __v; })) + __v; })) #else +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ul) >> 56) \ + | (((x) & 0x00ff000000000000ul) >> 40) \ + | (((x) & 0x0000ff0000000000ul) >> 24) \ + | (((x) & 0x000000ff00000000ul) >> 8) \ + | (((x) & 0x00000000ff000000ul) << 8) \ + | (((x) & 0x0000000000ff0000ul) << 24) \ + | (((x) & 0x000000000000ff00ul) << 40) \ + | (((x) & 0x00000000000000fful) << 56)) + static __inline unsigned long int __bswap_64 (unsigned long int __bsx) { diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h index 4bfd5fa064..0e0346bba4 100644 --- a/sysdeps/s390/bits/byteswap.h +++ b/sysdeps/s390/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. s390 version. - Copyright (C) 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2008, 2011 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -35,31 +35,31 @@ # if __WORDSIZE == 64 # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v, __x = (x); \ + ({ unsigned short int __v, __x = (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_16 (__x); \ else { \ - unsigned short int __tmp = (unsigned short int) (__x); \ - __asm__ __volatile__ ( \ - "lrvh %0,%1" \ - : "=&d" (__v) : "m" (__tmp) ); \ - } \ + unsigned short int __tmp = (unsigned short int) (__x); \ + __asm__ __volatile__ ( \ + "lrvh %0,%1" \ + : "=&d" (__v) : "m" (__tmp) ); \ + } \ __v; })) # else # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v, __x = (x); \ + ({ unsigned short int __v, __x = (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_16 (__x); \ else { \ - unsigned short int __tmp = (unsigned short int) (__x); \ - __asm__ __volatile__ ( \ - "sr %0,%0\n" \ - "la 1,%1\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ + unsigned short int __tmp = (unsigned short int) (__x); \ + __asm__ __volatile__ ( \ + "sr %0,%0\n" \ + "la 1,%1\n" \ + "icm %0,2,1(1)\n" \ + "ic %0,0(1)" \ + : "=&d" (__v) : "m" (__tmp) : "1"); \ + } \ __v; })) # endif #else @@ -80,32 +80,32 @@ __bswap_16 (unsigned short int __bsx) # if __WORDSIZE == 64 # define __bswap_32(x) \ (__extension__ \ - ({ unsigned int __v, __x = (x); \ + ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_32 (__x); \ else { \ - unsigned int __tmp = (unsigned int) (__x); \ - __asm__ __volatile__ ( \ - "lrv %0,%1" \ - : "=&d" (__v) : "m" (__tmp)); \ - } \ + unsigned int __tmp = (unsigned int) (__x); \ + __asm__ __volatile__ ( \ + "lrv %0,%1" \ + : "=&d" (__v) : "m" (__tmp)); \ + } \ __v; })) # else # define __bswap_32(x) \ (__extension__ \ - ({ unsigned int __v, __x = (x); \ + ({ unsigned int __v, __x = (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_32 (__x); \ else { \ - unsigned int __tmp = (unsigned int) (__x); \ - __asm__ __volatile__ ( \ - "la 1,%1\n" \ - "icm %0,8,3(1)\n" \ - "icm %0,4,2(1)\n" \ - "icm %0,2,1(1)\n" \ - "ic %0,0(1)" \ - : "=&d" (__v) : "m" (__tmp) : "1"); \ - } \ + unsigned int __tmp = (unsigned int) (__x); \ + __asm__ __volatile__ ( \ + "la 1,%1\n" \ + "icm %0,8,3(1)\n" \ + "icm %0,4,2(1)\n" \ + "icm %0,2,1(1)\n" \ + "ic %0,0(1)" \ + : "=&d" (__v) : "m" (__tmp) : "1"); \ + } \ __v; })) # endif #else @@ -117,37 +117,51 @@ __bswap_32 (unsigned int __bsx) #endif /* Swap bytes in 64 bit value. */ -#define __bswap_constant_64(x) \ - ((((x)&0xff00000000000000) >> 56) | (((x)&0x00ff000000000000) >> 40) | \ - (((x)&0x0000ff0000000000) >> 24) | (((x)&0x000000ff00000000) >> 8) | \ - (((x)&0x00000000ff000000) << 8) | (((x)&0x0000000000ff0000) << 24) | \ - (((x)&0x000000000000ff00) << 40) | (((x)&0x00000000000000ff) << 56)) - #if defined __GNUC__ && __GNUC__ >= 2 +# define __bswap_constant_64(x) \ + (__extension__ ((((x) & 0xff00000000000000ul) >> 56) \ + | (((x) & 0x00ff000000000000ul) >> 40) \ + | (((x) & 0x0000ff0000000000ul) >> 24) \ + | (((x) & 0x000000ff00000000ul) >> 8) \ + | (((x) & 0x00000000ff000000ul) << 8) \ + | (((x) & 0x0000000000ff0000ul) << 24) \ + | (((x) & 0x000000000000ff00ul) << 40) \ + | (((x) & 0x00000000000000fful) << 56))) + # if __WORDSIZE == 64 # define __bswap_64(x) \ (__extension__ \ - ({ unsigned long __w, __x = (x); \ + ({ unsigned long __w, __x = (x); \ if (__builtin_constant_p (x)) \ __w = __bswap_constant_64 (__x); \ else { \ - unsigned long __tmp = (unsigned long) (__x); \ - __asm__ __volatile__ ( \ - "lrvg %0,%1" \ - : "=&d" (__w) : "m" (__tmp)); \ - } \ + unsigned long __tmp = (unsigned long) (__x); \ + __asm__ __volatile__ ( \ + "lrvg %0,%1" \ + : "=&d" (__w) : "m" (__tmp)); \ + } \ __w; })) # else # define __bswap_64(x) \ __extension__ \ ({ 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; }) + 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 #else +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ul) >> 56) \ + | (((x) & 0x00ff000000000000ul) >> 40) \ + | (((x) & 0x0000ff0000000000ul) >> 24) \ + | (((x) & 0x000000ff00000000ul) >> 8) \ + | (((x) & 0x00000000ff000000ul) << 8) \ + | (((x) & 0x0000000000ff0000ul) << 24) \ + | (((x) & 0x000000000000ff00ul) << 40) \ + | (((x) & 0x00000000000000fful) << 56)) + static __inline unsigned long long int __bswap_64 (unsigned long long int __bsx) { diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h index e350fb8063..c6db93c41a 100644 --- a/sysdeps/x86_64/bits/byteswap.h +++ b/sysdeps/x86_64/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010 + Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -99,14 +99,14 @@ #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ # define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) \ - | (((x) & 0x00ff000000000000ull) >> 40) \ - | (((x) & 0x0000ff0000000000ull) >> 24) \ - | (((x) & 0x000000ff00000000ull) >> 8) \ - | (((x) & 0x00000000ff000000ull) << 8) \ - | (((x) & 0x0000000000ff0000ull) << 24) \ - | (((x) & 0x000000000000ff00ull) << 40) \ - | (((x) & 0x00000000000000ffull) << 56)) + (__extension__ ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56))) # if __WORDSIZE == 64 # define __bswap_64(x) \ |