Make bits/wchar.h correct for all architectures (bug 15036).

This commit is contained in:
Joseph Myers 2013-01-23 00:42:51 +00:00
parent 7c1e01aabc
commit 052aff9578
4 changed files with 35 additions and 35 deletions

View File

@ -1,3 +1,11 @@
2013-01-23 Joseph Myers <joseph@codesourcery.com>
[BZ #15036]
* bits/wchar.h (__WCHAR_MAX): Define based on __WCHAR_MAX__, or
based on [L'\0' - 1 > 0] if [!__WCHAR_MAX__].
(__WCHAR_MIN): Likewise, using __WCHAR_MIN__.
* sysdeps/unix/sysv/linux/x86/bits/wchar.h: Remove.
2013-01-21 David S. Miller <davem@davemloft.net>
* sysdeps/sparc/backtrace.c: New file.

2
NEWS
View File

@ -10,7 +10,7 @@ Version 2.18
* The following bugs are resolved with this release:
13951, 14200, 14317, 14327, 14496, 14964, 14981, 14982, 14985, 14994,
14996, 15003, 15020, 15023.
14996, 15003, 15020, 15023, 15036.
Version 2.17

View File

@ -19,7 +19,31 @@
#ifndef _BITS_WCHAR_H
#define _BITS_WCHAR_H 1
#define __WCHAR_MIN (-2147483647 - 1)
#define __WCHAR_MAX (2147483647)
/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__
are not defined, give the right value and type as long as both int
and wchar_t are 32-bit types. Adding L'\0' to a constant value
ensures that the type is correct; it is necessary to use (L'\0' +
0) rather than just L'\0' so that the type in C++ is the promoted
version of wchar_t rather than the distinct wchar_t type itself.
Because wchar_t in preprocessor #if expressions is treated as
intmax_t or uintmax_t, the expression (L'\0' - 1) would have the
wrong value for WCHAR_MAX in such expressions and so cannot be used
to define __WCHAR_MAX in the unsigned case. */
#ifdef __WCHAR_MAX__
# define __WCHAR_MAX __WCHAR_MAX__
#elif L'\0' - 1 > 0
# define __WCHAR_MAX (0xffffffffu + L'\0')
#else
# define __WCHAR_MAX (0x7fffffff + L'\0')
#endif
#ifdef __WCHAR_MIN__
# define __WCHAR_MIN __WCHAR_MIN__
#elif L'\0' - 1 > 0
# define __WCHAR_MIN (L'\0' + 0)
#else
# define __WCHAR_MIN (-__WCHAR_MAX - 1)
#endif
#endif /* bits/wchar.h */

View File

@ -1,32 +0,0 @@
/* wchar_t type related definitions. i386/x86-64 version.
Copyright (C) 2000-2013 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_WCHAR_H
#define _BITS_WCHAR_H 1
#include <bits/wordsize.h>
#if __WORDSIZE == 64
# define __WCHAR_MIN (-2147483647 - 1)
# define __WCHAR_MAX (2147483647)
#else
# define __WCHAR_MIN (-2147483647l - 1l)
# define __WCHAR_MAX (2147483647l)
#endif
#endif /* bits/wchar.h */