[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r17942 - in /fsf/trunk/libc: ./ abilist/ bits/ manual/ nss/ nss/nss_db/ scripts/ string/ sysdeps/i386/bits/ sysdeps/s390/bit...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r17942 - in /fsf/trunk/libc: ./ abilist/ bits/ manual/ nss/ nss/nss_db/ scripts/ string/ sysdeps/i386/bits/ sysdeps/s390/bit...
- From: eglibc@xxxxxxxxxx
- Date: Sat, 07 Apr 2012 00:02:05 -0000
Author: eglibc
Date: Sat Apr 7 00:02:04 2012
New Revision: 17942
Log:
Import glibc-mainline for 2012-04-07
Added:
fsf/trunk/libc/bits/byteswap-16.h
fsf/trunk/libc/nss/tst-nss-static.c
fsf/trunk/libc/sysdeps/i386/bits/byteswap-16.h
fsf/trunk/libc/sysdeps/s390/bits/byteswap-16.h
fsf/trunk/libc/sysdeps/x86_64/bits/byteswap-16.h
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/abilist/libc.abilist
fsf/trunk/libc/bits/byteswap.h
fsf/trunk/libc/manual/llio.texi
fsf/trunk/libc/nss/Makefile
fsf/trunk/libc/nss/nss_db/db-initgroups.c
fsf/trunk/libc/nss/nsswitch.c
fsf/trunk/libc/scripts/check-local-headers.sh
fsf/trunk/libc/string/Makefile
fsf/trunk/libc/sysdeps/i386/bits/byteswap.h
fsf/trunk/libc/sysdeps/s390/bits/byteswap.h
fsf/trunk/libc/sysdeps/x86_64/bits/byteswap.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Apr 7 00:02:04 2012
@@ -1,4 +1,41 @@
+2012-04-06 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * bits/byteswap.h (__bswap_16): Removed.
+ Include <bits/byteswap-16.h> to get __bswap_16.
+ * sysdeps/i386/bits/byteswap.h: Likewise.
+ * sysdeps/s390/bits/byteswap.h: Likewise.
+ * sysdeps/x86_64/bits/byteswap.h: Likewise.
+ * bits/byteswap-16.h: New file.
+ * sysdeps/i386/bits/byteswap-16.h: Likewise.
+ * sysdeps/s390/bits/byteswap-16.h: Likewise.
+ * sysdeps/x86_64/bits/byteswap-16.h: Likewise.
+ * string/Makefile (headers): Add bits/byteswap-16.h.
+
+2012-04-06 Paul Pluzhnikov <ppluzhnikov@xxxxxxxxxx>
+
+ [BZ #13895]
+ * nss/nsswitch.c (nss_load_library, __nss_lookup_function): Avoid
+ extra indirection.
+ * nss/Makefile (tests-static, tests): Add tst-nss-static.
+ * nss/tst-nss-static.c: New.
+
+2012-04-06 Robert Millan <rmh@xxxxxxx>
+
+ [BZ #6486]
+ * manual/llio.texi (File Position Primitive): lseek
+ refers to WHENCE when it really means OFFSET.
+
+2012-04-06 Andreas Jaeger <aj@xxxxxxx>
+
+ * nss/nss_db/db-initgroups.c: Include <string.h> for strlen and
+ strncmp declarations.
+
+ * abilist/libc.abilist: Add __poll and __ppoll.
+
2012-04-05 David S. Miller <davem@xxxxxxxxxxxxx>
+
+ * scripts/check-local-headers.sh: Accept a host triplet in the
+ path matched by the exclude regexp.
* elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Reduce down to one
definition.
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat Apr 7 00:02:04 2012
@@ -11,15 +11,15 @@
174, 350, 369, 411, 2541, 2547, 2548, 2551, 2552, 2553, 2554, 2562, 2563,
2565, 2566, 2576, 2678, 3335, 3866, 3868, 3976, 3992, 4026, 4108, 4596,
- 4822, 5077, 5461, 5805, 5993, 6471, 6730, 6770, 6884, 6907, 6911, 9739,
- 9902, 10110, 10135, 10140, 10210, 10346, 10545, 10716, 11174, 11322,
+ 4822, 5077, 5461, 5805, 5993, 6471, 6486, 6730, 6770, 6884, 6907, 6911,
+ 9739, 9902, 10110, 10135, 10140, 10210, 10346, 10545, 10716, 11174, 11322,
11365, 11451, 11494, 12047, 12340, 13058, 13525, 13526, 13527, 13528,
13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553, 13555,
13559, 13566, 13583, 13592, 13618, 13637, 13656, 13658, 13673, 13691,
13695, 13704, 13706, 13726, 13738, 13760, 13761, 13786, 13792, 13806,
13824, 13840, 13841, 13844, 13846, 13851, 13852, 13854, 13871, 13879,
- 13883, 13892, 13908, 13910, 13911, 13912, 13913, 13915, 13916, 13917,
- 13918, 13919, 13920, 13921, 13926, 13928, 13938
+ 13883, 13892, 13895, 13908, 13910, 13911, 13912, 13913, 13915, 13916,
+ 13917, 13918, 13919, 13920, 13921, 13926, 13928, 13938
* ISO C11 support:
Modified: fsf/trunk/libc/abilist/libc.abilist
==============================================================================
--- fsf/trunk/libc/abilist/libc.abilist (original)
+++ fsf/trunk/libc/abilist/libc.abilist Sat Apr 7 00:02:04 2012
@@ -2493,6 +2493,8 @@
scandirat64 F
GLIBC_2.16 i.86-.*-linux.*/thread powerpc-.*-linux.*/thread powerpc64-.*-linux.*/thread s390-.*-linux.*/thread s390x-.*-linux.*/thread sh[34].*-.*-linux.*/thread x86_64-.*-linux.*/thread
GLIBC_2.16 A
+ __poll_chk F
+ __ppoll_chk F
aligned_alloc F
c16rtomb F
c32rtomb F
Added: fsf/trunk/libc/bits/byteswap-16.h
==============================================================================
--- fsf/trunk/libc/bits/byteswap-16.h (added)
+++ fsf/trunk/libc/bits/byteswap-16.h Sat Apr 7 00:02:04 2012
@@ -1,0 +1,33 @@
+/* Macros to swap the order of bytes in 16-bit integer values.
+ Copyright (C) 2012 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_BYTESWAP_H
+# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead."
+#endif
+
+#ifdef __GNUC__
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); }))
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return __bswap_constant_16 (__bsx);
+}
+#endif
Modified: fsf/trunk/libc/bits/byteswap.h
==============================================================================
--- fsf/trunk/libc/bits/byteswap.h (original)
+++ fsf/trunk/libc/bits/byteswap.h Sat Apr 7 00:02:04 2012
@@ -27,17 +27,8 @@
#define __bswap_constant_16(x) \
((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
-#ifdef __GNUC__
-# define __bswap_16(x) \
- (__extension__ \
- ({ unsigned short int __bsx = (x); __bswap_constant_16 (__bsx); }))
-#else
-static __inline unsigned short int
-__bswap_16 (unsigned short int __bsx)
-{
- return __bswap_constant_16 (__bsx);
-}
-#endif
+/* Get __bswap_16. */
+#include <bits/byteswap-16.h>
/* Swap bytes in 32 bit value. */
#define __bswap_constant_32(x) \
Modified: fsf/trunk/libc/manual/llio.texi
==============================================================================
--- fsf/trunk/libc/manual/llio.texi (original)
+++ fsf/trunk/libc/manual/llio.texi Sat Apr 7 00:02:04 2012
@@ -634,15 +634,15 @@
@table @code
@item SEEK_SET
-Specifies that @var{whence} is a count of characters from the beginning
+Specifies that @var{offset} is a count of characters from the beginning
of the file.
@item SEEK_CUR
-Specifies that @var{whence} is a count of characters from the current
+Specifies that @var{offset} is a count of characters from the current
file position. This count may be positive or negative.
@item SEEK_END
-Specifies that @var{whence} is a count of characters from the end of
+Specifies that @var{offset} is a count of characters from the end of
the file. A negative count specifies a position within the current
extent of the file; a positive count specifies a position past the
current end. If you set the position past the current end, and
Modified: fsf/trunk/libc/nss/Makefile
==============================================================================
--- fsf/trunk/libc/nss/Makefile (original)
+++ fsf/trunk/libc/nss/Makefile Sat Apr 7 00:02:04 2012
@@ -75,6 +75,8 @@
ifeq ($(build-static-nss),yes)
routines += $(libnss_files-routines)
static-only-routines += $(libnss_files-routines)
+tests-static = tst-nss-static
+tests += $(tests-static)
endif
include ../Rules
Modified: fsf/trunk/libc/nss/nss_db/db-initgroups.c
==============================================================================
--- fsf/trunk/libc/nss/nss_db/db-initgroups.c (original)
+++ fsf/trunk/libc/nss/nss_db/db-initgroups.c Sat Apr 7 00:02:04 2012
@@ -1,5 +1,5 @@
/* Initgroups handling in nss_db module.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxx>.
@@ -21,6 +21,7 @@
#include <errno.h>
#include <grp.h>
#include <paths.h>
+#include <string.h>
#include "nss_db.h"
Modified: fsf/trunk/libc/nss/nsswitch.c
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.c (original)
+++ fsf/trunk/libc/nss/nsswitch.c Sat Apr 7 00:02:04 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2007,2009,2010,2011
+/* Copyright (C) 1996-2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -315,7 +315,7 @@
if (ni->library->lib_handle == NULL)
{
/* Load the shared library. */
- size_t shlen = (7 + strlen (ni->library->name) + 3
+ size_t shlen = (7 + strlen (ni->name) + 3
+ strlen (__nss_shlib_revision) + 1);
int saved_errno = errno;
char shlib_name[shlen];
@@ -323,7 +323,7 @@
/* Construct shared object name. */
__stpcpy (__stpcpy (__stpcpy (__stpcpy (shlib_name,
"libnss_"),
- ni->library->name),
+ ni->name),
".so"),
__nss_shlib_revision);
@@ -337,14 +337,14 @@
else if (is_nscd)
{
/* Call the init function when nscd is used. */
- size_t initlen = (5 + strlen (ni->library->name)
+ size_t initlen = (5 + strlen (ni->name)
+ strlen ("_init") + 1);
char init_name[initlen];
/* Construct the init function name. */
__stpcpy (__stpcpy (__stpcpy (init_name,
"_nss_"),
- ni->library->name),
+ ni->name),
"_init");
/* Find the optional init function. */
@@ -428,13 +428,13 @@
else
{
/* Get the desired function. */
- size_t namlen = (5 + strlen (ni->library->name) + 1
+ size_t namlen = (5 + strlen (ni->name) + 1
+ strlen (fct_name) + 1);
char name[namlen];
/* Construct the function name. */
__stpcpy (__stpcpy (__stpcpy (__stpcpy (name, "_nss_"),
- ni->library->name),
+ ni->name),
"_"),
fct_name);
@@ -457,12 +457,12 @@
# include "function.def"
{ NULL, NULL }
};
- size_t namlen = (5 + strlen (ni->library->name) + 1
+ size_t namlen = (5 + strlen (ni->name) + 1
+ strlen (fct_name) + 1);
char name[namlen];
/* Construct the function name. */
- __stpcpy (__stpcpy (__stpcpy (name, ni->library->name),
+ __stpcpy (__stpcpy (__stpcpy (name, ni->name),
"_"),
fct_name);
Added: fsf/trunk/libc/nss/tst-nss-static.c
==============================================================================
--- fsf/trunk/libc/nss/tst-nss-static.c (added)
+++ fsf/trunk/libc/nss/tst-nss-static.c Sat Apr 7 00:02:04 2012
@@ -1,0 +1,15 @@
+/* glibc test for static NSS. */
+#include <stdio.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+ struct passwd *pw;
+
+ pw = getpwuid(0);
+ return pw == NULL;
+}
+
+
+#include "../test-skeleton.c"
Modified: fsf/trunk/libc/scripts/check-local-headers.sh
==============================================================================
--- fsf/trunk/libc/scripts/check-local-headers.sh (original)
+++ fsf/trunk/libc/scripts/check-local-headers.sh Sat Apr 7 00:02:04 2012
@@ -28,7 +28,7 @@
BEGIN {
status = 0
exclude = "^" includedir \
- "/(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h)"
+ "/(.*-.*-.*/|)(asm[-/]|linux/|selinux/|gd|nss3/|sys/capability\\.h|libaudit\\.h)"
}
/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
{
Modified: fsf/trunk/libc/string/Makefile
==============================================================================
--- fsf/trunk/libc/string/Makefile (original)
+++ fsf/trunk/libc/string/Makefile Sat Apr 7 00:02:04 2012
@@ -21,8 +21,8 @@
subdir := string
headers := string.h strings.h memory.h endian.h bits/endian.h \
- argz.h envz.h byteswap.h bits/byteswap.h bits/string.h \
- bits/string2.h bits/string3.h
+ argz.h envz.h byteswap.h bits/byteswap.h bits/byteswap-16.h \
+ bits/string.h bits/string2.h bits/string3.h
routines := strcat strchr strcmp strcoll strcpy strcspn \
strverscmp strdup strndup \
Added: fsf/trunk/libc/sysdeps/i386/bits/byteswap-16.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/bits/byteswap-16.h (added)
+++ fsf/trunk/libc/sysdeps/i386/bits/byteswap-16.h Sat Apr 7 00:02:04 2012
@@ -1,0 +1,49 @@
+/* Macros to swap the order of bytes in 16-bit integer values.
+ Copyright (C) 2012 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_BYTESWAP_H
+# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead."
+#endif
+
+#ifdef __GNUC__
+# if __GNUC__ >= 2
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
+ if (__builtin_constant_p (__x)) \
+ __v = __bswap_constant_16 (__x); \
+ else \
+ __asm__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# else
+/* This is better than nothing. */
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __x = (unsigned short int) (x); \
+ __bswap_constant_16 (__x); }))
+# endif
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return __bswap_constant_16 (__bsx);
+}
+#endif
Modified: fsf/trunk/libc/sysdeps/i386/bits/byteswap.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/bits/byteswap.h (original)
+++ fsf/trunk/libc/sysdeps/i386/bits/byteswap.h Sat Apr 7 00:02:04 2012
@@ -27,33 +27,8 @@
#define __bswap_constant_16(x) \
((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
-#ifdef __GNUC__
-# if __GNUC__ >= 2
-# define __bswap_16(x) \
- (__extension__ \
- ({ register unsigned short int __v, __x = (unsigned short int) (x); \
- if (__builtin_constant_p (__x)) \
- __v = __bswap_constant_16 (__x); \
- else \
- __asm__ ("rorw $8, %w0" \
- : "=r" (__v) \
- : "0" (__x) \
- : "cc"); \
- __v; }))
-# else
-/* This is better than nothing. */
-# define __bswap_16(x) \
- (__extension__ \
- ({ register unsigned short int __x = (unsigned short int) (x); \
- __bswap_constant_16 (__x); }))
-# endif
-#else
-static __inline unsigned short int
-__bswap_16 (unsigned short int __bsx)
-{
- return __bswap_constant_16 (__bsx);
-}
-#endif
+/* Get __bswap_16. */
+#include <bits/byteswap-16.h>
/* Swap bytes in 32 bit value. */
#define __bswap_constant_32(x) \
Added: fsf/trunk/libc/sysdeps/s390/bits/byteswap-16.h
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/bits/byteswap-16.h (added)
+++ fsf/trunk/libc/sysdeps/s390/bits/byteswap-16.h Sat Apr 7 00:02:04 2012
@@ -1,0 +1,65 @@
+/* Macros to swap the order of bytes in 16-bit integer values. s390 version
+ Copyright (C) 2012 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@xxxxxxxxxx).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_BYTESWAP_H
+# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+/* Swap bytes in 16 bit value. */
+#if defined __GNUC__ && __GNUC__ >= 2
+# if __WORDSIZE == 64
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ 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) ); \
+ } \
+ __v; }))
+# else
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ 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"); \
+ } \
+ __v; }))
+# endif
+#else
+/* This is better than nothing. */
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return __bswap_constant_16 (__bsx);
+}
+#endif
Modified: fsf/trunk/libc/sysdeps/s390/bits/byteswap.h
==============================================================================
--- fsf/trunk/libc/sysdeps/s390/bits/byteswap.h (original)
+++ fsf/trunk/libc/sysdeps/s390/bits/byteswap.h Sat Apr 7 00:02:04 2012
@@ -29,46 +29,8 @@
#define __bswap_constant_16(x) \
((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
-/* Swap bytes in 16 bit value. */
-#if defined __GNUC__ && __GNUC__ >= 2
-# if __WORDSIZE == 64
-# define __bswap_16(x) \
- (__extension__ \
- ({ 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) ); \
- } \
- __v; }))
-# else
-# define __bswap_16(x) \
- (__extension__ \
- ({ 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"); \
- } \
- __v; }))
-# endif
-#else
-/* This is better than nothing. */
-static __inline unsigned short int
-__bswap_16 (unsigned short int __bsx)
-{
- return __bswap_constant_16 (__bsx);
-}
-#endif
+/* Get __bswap_16. */
+#include <bits/byteswap-16.h>
/* Swap bytes in 32 bit value. */
#define __bswap_constant_32(x) \
Added: fsf/trunk/libc/sysdeps/x86_64/bits/byteswap-16.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/bits/byteswap-16.h (added)
+++ fsf/trunk/libc/sysdeps/x86_64/bits/byteswap-16.h Sat Apr 7 00:02:04 2012
@@ -1,0 +1,49 @@
+/* Macros to swap the order of bytes in 16-bit integer values.
+ Copyright (C) 2012 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_BYTESWAP_H
+# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead."
+#endif
+
+#ifdef __GNUC__
+# if __GNUC__ >= 2
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __v, __x = (unsigned short int) (x); \
+ if (__builtin_constant_p (__x)) \
+ __v = __bswap_constant_16 (__x); \
+ else \
+ __asm__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# else
+/* This is better than nothing. */
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ register unsigned short int __x = (unsigned short int) (x); \
+ __bswap_constant_16 (__x); }))
+# endif
+#else
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return __bswap_constant_16 (__bsx);
+}
+#endif
Modified: fsf/trunk/libc/sysdeps/x86_64/bits/byteswap.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/bits/byteswap.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/bits/byteswap.h Sat Apr 7 00:02:04 2012
@@ -29,26 +29,8 @@
#define __bswap_constant_16(x) \
((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
-#if defined __GNUC__ && __GNUC__ >= 2
-# define __bswap_16(x) \
- (__extension__ \
- ({ register unsigned short int __v, __x = (unsigned short int) (x); \
- if (__builtin_constant_p (__x)) \
- __v = __bswap_constant_16 (__x); \
- else \
- __asm__ ("rorw $8, %w0" \
- : "=r" (__v) \
- : "0" (__x) \
- : "cc"); \
- __v; }))
-#else
-/* This is better than nothing. */
-# define __bswap_16(x) \
- (__extension__ \
- ({ register unsigned short int __x = (unsigned short int) (x); \
- __bswap_constant_16 (__x); }))
-#endif
-
+/* Get __bswap_16. */
+#include <bits/byteswap-16.h>
/* Swap bytes in 32 bit value. */
#define __bswap_constant_32(x) \
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits