From 2174c6dd8555f654c30df2f8f3321b69e0f736f8 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 21 Jun 2012 15:49:33 +0200 Subject: [PATCH] Avoid -Wconversion warning for htons --- ChangeLog | 9 +++++++++ NEWS | 30 +++++++++++++++--------------- bits/byteswap-16.h | 3 ++- bits/byteswap.h | 2 +- sysdeps/s390/bits/byteswap-16.h | 4 ++-- sysdeps/s390/bits/byteswap.h | 4 ++-- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 102ccba5c2..1363c788e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-06-21 Andreas Jaeger + + [BZ #12194] + * sysdeps/s390/bits/byteswap-16.h (__bswap_16): Avoid -Wconversion + warning. + * sysdeps/s390/bits/byteswap.h (__bswap_constant_16): Likewise. + * bits/byteswap-16.h (__bswap_16): Likewise. + * bits/byteswap.h (__bswap_constant_16): Likewise. + 2012-06-18 H.J. Lu [BZ #14117] diff --git a/NEWS b/NEWS index b46122bc1b..97ab8fead9 100644 --- a/NEWS +++ b/NEWS @@ -16,21 +16,21 @@ Version 2.16 6884, 6890, 6894, 6895, 6907, 6911, 6959, 7064, 9739, 9902, 10110, 10135, 10140, 10153, 10210, 10254, 10346, 10375, 10545, 10716, 10846, 11174, 11322, 11365, 11451, 11494, 11521, 11677, 11837, 11959, 12047, 12097, - 12193, 12297, 12298, 12301, 12340, 12354, 12416, 12495, 13058, 13223, - 13361, 13525, 13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, - 13547, 13551, 13552, 13553, 13555, 13556, 13559, 13563, 13566, 13576, - 13583, 13592, 13594, 13613, 13618, 13637, 13656, 13658, 13673, 13691, - 13695, 13704, 13705, 13706, 13718, 13726, 13738, 13739, 13743, 13750, - 13758, 13760, 13761, 13775, 13786, 13787, 13792, 13806, 13824, 13840, - 13841, 13844, 13846, 13848, 13851, 13852, 13854, 13871, 13872, 13873, - 13879, 13883, 13884, 13885, 13886, 13892, 13895, 13908, 13910, 13911, - 13912, 13913, 13914, 13915, 13916, 13917, 13918, 13919, 13920, 13921, - 13922, 13923, 13924, 13926, 13927, 13928, 13938, 13941, 13942, 13954, - 13955, 13956, 13963, 13967, 13968, 13970, 13973, 13979, 13983, 13986, - 13996, 14012, 14027, 14033, 14034, 14036, 14040, 14043, 14044, 14048, - 14049, 14050, 14053, 14055, 14059, 14064, 14075, 14080, 14083, 14103, - 14104, 14109, 14112, 14117, 14122, 14123, 14134, 14153, 14183, 14188, - 14199, 14210, 14218, 14229, 14241 + 12193, 12194, 12297, 12298, 12301, 12340, 12354, 12416, 12495, 13058, + 13223, 13361, 13525, 13526, 13527, 13528, 13529, 13530, 13531, 13532, + 13533, 13547, 13551, 13552, 13553, 13555, 13556, 13559, 13563, 13566, + 13576, 13583, 13592, 13594, 13613, 13618, 13637, 13656, 13658, 13673, + 13691, 13695, 13704, 13705, 13706, 13718, 13726, 13738, 13739, 13743, + 13750, 13758, 13760, 13761, 13775, 13786, 13787, 13792, 13806, 13824, + 13840, 13841, 13844, 13846, 13848, 13851, 13852, 13854, 13871, 13872, + 13873, 13879, 13883, 13884, 13885, 13886, 13892, 13895, 13908, 13910, + 13911, 13912, 13913, 13914, 13915, 13916, 13917, 13918, 13919, 13920, + 13921, 13922, 13923, 13924, 13926, 13927, 13928, 13938, 13941, 13942, + 13954, 13955, 13956, 13963, 13967, 13968, 13970, 13973, 13979, 13983, + 13986, 13996, 14012, 14027, 14033, 14034, 14036, 14040, 14043, 14044, + 14048, 14049, 14050, 14053, 14055, 14059, 14064, 14075, 14080, 14083, + 14103, 14104, 14109, 14112, 14117, 14122, 14123, 14134, 14153, 14183, + 14188, 14199, 14210, 14218, 14229, 14241 * Support for the x32 ABI on x86-64 added. The x32 target is selected by configuring glibc with: diff --git a/bits/byteswap-16.h b/bits/byteswap-16.h index 078dd0e17a..6cc1d30932 100644 --- a/bits/byteswap-16.h +++ b/bits/byteswap-16.h @@ -23,7 +23,8 @@ #ifdef __GNUC__ # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); })) + ({ unsigned short int __bsx = (unsigned short int) (x); \ + __bswap_constant_16 (__bsx); })) #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) diff --git a/bits/byteswap.h b/bits/byteswap.h index d818293a4c..3ca0ad6986 100644 --- a/bits/byteswap.h +++ b/bits/byteswap.h @@ -27,7 +27,7 @@ /* Swap bytes in 16 bit value. */ #define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) + ((unsigned short int)((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))) /* Get __bswap_16. */ #include diff --git a/sysdeps/s390/bits/byteswap-16.h b/sysdeps/s390/bits/byteswap-16.h index 8bfec78ffe..126f382145 100644 --- a/sysdeps/s390/bits/byteswap-16.h +++ b/sysdeps/s390/bits/byteswap-16.h @@ -28,7 +28,7 @@ # if __WORDSIZE == 64 # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v, __x = (x); \ + ({ unsigned short int __v, __x = (unsigned short int) (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_16 (__x); \ else { \ @@ -41,7 +41,7 @@ # else # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __v, __x = (x); \ + ({ unsigned short int __v, __x = (unsigned short int) (x); \ if (__builtin_constant_p (x)) \ __v = __bswap_constant_16 (__x); \ else { \ diff --git a/sysdeps/s390/bits/byteswap.h b/sysdeps/s390/bits/byteswap.h index e91d4ccb8f..3ae6436bb3 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-2003, 2008, 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 2000-2012 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -27,7 +27,7 @@ #define _BITS_BYTESWAP_H 1 #define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) + ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) /* Get __bswap_16. */ #include