diff options
| author | Ulrich Drepper <drepper@gmail.com> | 2012-01-03 07:54:34 -0500 |
|---|---|---|
| committer | Ulrich Drepper <drepper@gmail.com> | 2012-01-03 07:54:34 -0500 |
| commit | aff067358751a03ad1f9e397204490b8bfb2fb29 (patch) | |
| tree | 6d462d2049b215370a4f1075629d71e695ba600d | |
| parent | 9f1151705e3d861a4d6d680e74158cd708119053 (diff) | |
| parent | db6af3ebf46a83b885455dc03a3c2c1c2c2dedec (diff) | |
| download | glibc-aff067358751a03ad1f9e397204490b8bfb2fb29.tar.xz glibc-aff067358751a03ad1f9e397204490b8bfb2fb29.zip | |
Merge branch 'c11'
| -rw-r--r-- | ChangeLog | 56 | ||||
| -rw-r--r-- | NEWS | 21 | ||||
| -rw-r--r-- | Versions.def | 1 | ||||
| -rw-r--r-- | assert/assert.h | 9 | ||||
| -rw-r--r-- | debug/tst-chk1.c | 6 | ||||
| -rw-r--r-- | iconv/gconv_builtin.h | 23 | ||||
| -rw-r--r-- | iconv/gconv_int.h | 4 | ||||
| -rw-r--r-- | iconv/gconv_simple.c | 75 | ||||
| -rw-r--r-- | include/features.h | 30 | ||||
| -rw-r--r-- | libio/stdio.h | 8 | ||||
| -rw-r--r-- | malloc/Versions | 3 | ||||
| -rw-r--r-- | malloc/malloc.c | 2 | ||||
| -rw-r--r-- | stdio-common/tst-gets.c | 7 | ||||
| -rw-r--r-- | stdlib/stdlib.h | 14 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/timespec_get.c | 57 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timespec_get.c | 10 | ||||
| -rw-r--r-- | time/Makefile | 5 | ||||
| -rw-r--r-- | time/Versions | 3 | ||||
| -rw-r--r-- | time/time.h | 43 | ||||
| -rw-r--r-- | time/timespec_get.c | 40 | ||||
| -rw-r--r-- | version.h | 4 | ||||
| -rw-r--r-- | wcsmbs/Makefile | 5 | ||||
| -rw-r--r-- | wcsmbs/Versions | 3 | ||||
| -rw-r--r-- | wcsmbs/c16rtomb.c | 121 | ||||
| -rw-r--r-- | wcsmbs/mbrtoc16.c | 122 | ||||
| -rw-r--r-- | wcsmbs/mbrtowc.c | 7 | ||||
| -rw-r--r-- | wcsmbs/uchar.h | 84 | ||||
| -rw-r--r-- | wcsmbs/wchar.h | 10 | ||||
| -rw-r--r-- | wcsmbs/wcrtomb.c | 7 | ||||
| -rw-r--r-- | wcsmbs/wcsmbsload.c | 90 | ||||
| -rw-r--r-- | wcsmbs/wcsmbsload.h | 7 |
31 files changed, 825 insertions, 52 deletions
@@ -30,8 +30,64 @@ * posix/regex_internal.c (re_string_fetch_byte_case): Remove pure attribute. +2011-12-24 Ulrich Drepper <drepper@gmail.com> + + * iconv/gconv_simple.c: Add ASCII<->UTF-16 transformations. + * iconv/gconv_builtin.h: Add entries for internal ASCII<->UTF-16 + transformations. + * iconv/gconv_int.h: Likewise. + * wcsmbs/Makefile (routines): Add mbrtoc16 and c16rtomb. + * wcsmbs/Versions: Export mbrtoc16, c16rtomb, mbrtoc32, c32rtomb + from libc for GLIBC_2.16. + * wcsmbs/mbrtowc.c: Define mbrtoc32 alias. + * wcsmbs/wcrtomb.c: Define c32rtomb alias. + * wcsmbs/uchar.h: Really define mbstate_t. + * wcsmbs/wchar.h: Allow defining mbstate_t in uchar.h. + * wcsmbs/c16rtomb.c: New file. + * wcsmbs/mbrtoc16.c: New file. + * wcsmbs/wcsmbsload.c: Add static definitions for c16 conversions + for C/POSIX locale. + (__wcsmbs_load_conv): Do not fill in c16 routines yet. + * wcsmbs/wcsmbsload.h (gconv_fcts): Add entries for c16 routines. + + * wcsmbs/wchar.h: Add missing __restrict. + 2011-12-23 Ulrich Drepper <drepper@gmail.com> + [BZ #13532] + * time/Makefile (routines): Add timespec_get. + * time/Versions: Export timespec_get from libc for GLIBC_2.16. + * time/time.h: Define TIME_UTC and declare timespec_get. Define + timespec for ISO C11. + * time/timespec_get.c: New file. + * sysdeps/unix/sysv/linux/timespec_get.c: New file. + * sysdeps/unix/sysv/linux/x86_64/timespec_get.c: New file. + + [BZ #13531] + * malloc/malloc.c: Define alias aligned_alloc for public_mEMALIGn. + * stdlib/stdlib.h: Declare aligned_alloc. + * Versions.def: Add GLIBC_2.16 for libc. + * malloc/Versions: Export aligned_alloc from libc for GLIBC_2.16. + + [BZ 13527] + * stdlib/stdlib.h: Make at_quick_exit and quick_exit available for + ISO C11. + + * include/features.h: Define __USE_ISOCXX11 when compiling ISO C++11 + code. + + [BZ #13528] + * libio/stdio.h: Do not declare gets for ISO C11 and _GNU_SOURCE. + + [BZ #13529] + * assert/assert.h (static_assert): Define. + + * version.h: Update for 2.16 development version. + + [BZ #13526] + * include/features.h: Handle __STDC_VERSION__ >= 201112 and + _ISOC11_SOURCE. + * version.h (RELEASE): Bump for 2.15 release. * include/features.h (__GLIBC_MINOR__): Bump to 15. @@ -5,6 +5,27 @@ See the end for copying conditions. Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/> using `glibc' in the "product" field. +Version 2.16 + +* The following bugs are resolved with this release: + + 13526, 13527, 13528, 13529, 13531, 13532 + +* ISO C11 support: + + + define static_assert + + + do not declare gets + + + declare at_quick_exit and quick_exit also for ISO C11 + + + aligned_alloc. NB: The code is deliberately allows the size parameter + to not be a multiple of the alignment. This is a moronic requirement + in the standard but it is only a requirement on the caller, not the + implementation. + + + timespec_get added + Version 2.15 * The following bugs are resolved with this release: diff --git a/Versions.def b/Versions.def index 6b05e5ba5d..2b44f5e0bb 100644 --- a/Versions.def +++ b/Versions.def @@ -32,6 +32,7 @@ libc { GLIBC_2.13 GLIBC_2.14 GLIBC_2.15 + GLIBC_2.16 HURD_CTHREADS_0.3 %ifdef EXPORT_UNWIND_FIND_FDE GCC_3.0 diff --git a/assert/assert.h b/assert/assert.h index 841f435973..4022e28b55 100644 --- a/assert/assert.h +++ b/assert/assert.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1994-2001,2003,2004,2007 +/* Copyright (C) 1991,1992,1994-2001,2003,2004,2007,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -113,3 +113,10 @@ __END_DECLS # endif #endif /* NDEBUG. */ + + +#ifdef __USE_ISOC11 +/* Static assertion. Requires support in the compiler. */ +# undef static_assert +# define static_assert _Static_assert +#endif diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c index 0ec8ab07d9..7f0186e706 100644 --- a/debug/tst-chk1.c +++ b/debug/tst-chk1.c @@ -33,6 +33,12 @@ #include <sys/socket.h> #include <sys/un.h> +__BEGIN_DECLS +/* The <stdio.h> header does not include the declaration for gets + anymore when compiling with _GNU_SOURCE. Provide a copy here. */ +extern char *gets (char *__s); +__END_DECLS + #define obstack_chunk_alloc malloc #define obstack_chunk_free free diff --git a/iconv/gconv_builtin.h b/iconv/gconv_builtin.h index ef9ab8d7cf..fd736a480d 100644 --- a/iconv/gconv_builtin.h +++ b/iconv/gconv_builtin.h @@ -1,5 +1,5 @@ /* Builtin transformations. - Copyright (C) 1997-1999, 2000-2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2000-2002, 2006, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -122,3 +122,24 @@ BUILTIN_TRANSFORMATION ("INTERNAL", "UNICODEBIG//", 1, __gconv_transform_internal_ucs2reverse, NULL, 4, 4, 2, 2) #endif + + +BUILTIN_TRANSFORMATION ("ANSI_X3.4-1968//", "UTF-16//", 1, "=ascii->UTF-16", + __gconv_transform_ascii_utf16, NULL, 2, 2, 1, 1) + +BUILTIN_TRANSFORMATION ("UTF-16//", "ANSI_X3.4-1968//", 1, "=UTF-16->ascii", + __gconv_transform_utf16_ascii, NULL, 2, 2, 1, 1) + +#if BYTE_ORDER == BIG_ENDIAN +BUILTIN_TRANSFORMATION ("ANSI_X3.4-1968//", "UTF-16BE//", 1, "=ascii->UTF-16BE", + __gconv_transform_ascii_utf16, NULL, 2, 2, 1, 1) + +BUILTIN_TRANSFORMATION ("UTF-16BE//", "ANSI_X3.4-1968//", 1, "=UTF-16BE->ascii", + __gconv_transform_utf16_ascii, NULL, 2, 2, 1, 1) +#else +BUILTIN_TRANSFORMATION ("ANSI_X3.4-1968//", "UTF-16LE//", 1, "=ascii->UTF-16LE", + __gconv_transform_ascii_utf16, NULL, 2, 2, 1, 1) + +BUILTIN_TRANSFORMATION ("UTF-16LE//", "ANSI_X3.4-1968//", 1, "=UTF-16LE->ascii", + __gconv_transform_utf16_ascii, NULL, 2, 2, 1, 1) +#endif diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h index fd112204bc..80253dd5be 100644 --- a/iconv/gconv_int.h +++ b/iconv/gconv_int.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1997-2005, 2006, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -303,6 +303,8 @@ __BUILTIN_TRANSFORM (__gconv_transform_internal_ucs4le); __BUILTIN_TRANSFORM (__gconv_transform_ucs4le_internal); __BUILTIN_TRANSFORM (__gconv_transform_internal_utf16); __BUILTIN_TRANSFORM (__gconv_transform_utf16_internal); +__BUILTIN_TRANSFORM (__gconv_transform_ascii_utf16); +__BUILTIN_TRANSFORM (__gconv_transform_utf16_ascii); # undef __BUITLIN_TRANSFORM /* Specialized conversion function for a single byte to INTERNAL, recognizing diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c index e34f3770ad..b0ef3e67b0 100644 --- a/iconv/gconv_simple.c +++ b/iconv/gconv_simple.c @@ -1,5 +1,5 @@ /* Simple transformations functions. - Copyright (C) 1997-2005, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-2005, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -965,7 +965,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step, cnt = 2; \ ch &= 0x1f; \ } \ - else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \ + else if (__builtin_expect ((ch & 0xf0) == 0xe0, 1)) \ { \ /* We expect three bytes. */ \ cnt = 3; \ @@ -1221,7 +1221,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step, else \ { \ put16 (outptr, val); \ - outptr += sizeof (uint16_t); \ + outptr += sizeof (uint16_t); \ inptr += 4; \ } \ } @@ -1320,3 +1320,72 @@ ucs4le_internal_loop_single (struct __gconv_step *step, #define LOOP_NEED_FLAGS #include <iconv/loop.c> #include <iconv/skeleton.c> + + +/* Convert from ISO 646-IRV to UTF-16. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 1 +#define MIN_NEEDED_TO 2 +#define FROM_DIRECTION 1 +#define FROM_LOOP ascii_utf16_loop +#define TO_LOOP ascii_utf16_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_ascii_utf16 +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + if (__builtin_expect (*inptr > '\x7f', 0)) \ + { \ + /* The value is too large. We don't try transliteration here since \ + this is not an error because of the lack of possibilities to \ + represent the result. This is a genuine bug in the input since \ + ASCII does not allow such values. */ \ + STANDARD_FROM_LOOP_ERR_HANDLER (1); \ + } \ + else \ + { \ + /* It's an one byte sequence. */ \ + *((uint16_t *) outptr) = *inptr++; \ + outptr += sizeof (uint16_t); \ + } \ + } +#define LOOP_NEED_FLAGS +#include <iconv/loop.c> +#include <iconv/skeleton.c> + + +/* Convert from UTF-16 to ISO 646-IRV. */ +#define DEFINE_INIT 0 +#define DEFINE_FINI 0 +#define MIN_NEEDED_FROM 2 +#define MIN_NEEDED_TO 1 +#define FROM_DIRECTION 1 +#define FROM_LOOP utf16_ascii_loop +#define TO_LOOP utf16_ascii_loop /* This is not used. */ +#define FUNCTION_NAME __gconv_transform_utf16_ascii +#define ONE_DIRECTION 1 + +#define MIN_NEEDED_INPUT MIN_NEEDED_FROM +#define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define LOOPFCT FROM_LOOP +#define BODY \ + { \ + if (__builtin_expect (*((const uint16_t *) inptr) > 0x7f, 0)) \ + { \ + UNICODE_TAG_HANDLER (*((const uint16_t *) inptr), 2); \ + STANDARD_TO_LOOP_ERR_HANDLER (2); \ + } \ + else \ + { \ + /* It's an one byte sequence. */ \ + *outptr++ = *((const uint16_t *) inptr); \ + inptr += sizeof (uint16_t); \ + } \ + } +#define LOOP_NEED_FLAGS +#include <iconv/loop.c> +#include <iconv/skeleton.c> diff --git a/include/features.h b/include/features.h index c7b7972806..7bb27c5b08 100644 --- a/include/features.h +++ b/include/features.h @@ -25,6 +25,7 @@ __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. + _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993; @@ -57,6 +58,7 @@ These are defined by this file and are used by the header files to decide what to declare or define: + __USE_ISOC11 Define ISO C11 things. __USE_ISOC99 Define ISO C99 things. __USE_ISOC95 Define ISO C90 AMD1 (C95) things. __USE_POSIX Define IEEE Std 1003.1 things. @@ -95,8 +97,10 @@ /* Undefine everything, so we get a clean slate. */ +#undef __USE_ISOC11 #undef __USE_ISOC99 #undef __USE_ISOC95 +#undef __USE_ISOCXX11 #undef __USE_POSIX #undef __USE_POSIX2 #undef __USE_POSIX199309 @@ -158,6 +162,8 @@ # define _ISOC95_SOURCE 1 # undef _ISOC99_SOURCE # define _ISOC99_SOURCE 1 +# undef _ISOC11_SOURCE +# define _ISOC11_SOURCE 1 # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE @@ -185,21 +191,33 @@ # define _SVID_SOURCE 1 #endif -/* This is to enable the ISO C99 extension. Also recognize the old macro - which was used prior to the standard acceptance. This macro will - eventually go away and the features enabled by default once the ISO C99 - standard is widely adopted. */ -#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ +/* This is to enable the ISO C11 extension. */ +#if (defined _ISOC11_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) +# define __USE_ISOC11 1 +#endif + +/* This is to enable the ISO C99 extension. */ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __USE_ISOC99 1 #endif /* This is to enable the ISO C90 Amendment 1:1995 extension. */ -#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) # define __USE_ISOC95 1 #endif +/* This is to enable compatibility for ISO C++11. + + So far g++ does not provide a macro. Check the temporary macro for + now, too. */ +#if ((defined __cplusplus && __cplusplus >= 201103L) \ + || defined __GXX_EXPERIMENTAL_CXX0X__) +# define __USE_ISOCXX11 1 +#endif + /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \ diff --git a/libio/stdio.h b/libio/stdio.h index 8e23903c25..b39202879c 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -628,12 +628,18 @@ __BEGIN_NAMESPACE_STD extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) __wur; +#ifndef __USE_ISOC11 /* Get a newline-terminated string from stdin, removing the newline. DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. + The function has been officially removed in ISO C11. This opportunity + is used to also remove it from the GNU feature list. It is now only + available when explicitly using an old ISO C, Unix, or POSIX standard. + This function is a possible cancellation point and therefore not marked with __THROW. */ -extern char *gets (char *__s) __wur; +extern char *gets (char *__s) __wur __attribute_deprecated__; +#endif __END_NAMESPACE_STD #ifdef __USE_GNU diff --git a/malloc/Versions b/malloc/Versions index cf0b1e559a..7ca9bdf25f 100644 --- a/malloc/Versions +++ b/malloc/Versions @@ -58,6 +58,9 @@ libc { GLIBC_2.10 { malloc_info; } + GLIBC_2.16 { + aligned_alloc; + } GLIBC_PRIVATE { # Internal startup hook for libpthread. __libc_malloc_pthread_startup; diff --git a/malloc/malloc.c b/malloc/malloc.c index 8608083adb..300e879b8c 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3124,6 +3124,8 @@ public_mEMALIGn(size_t alignment, size_t bytes) ar_ptr == arena_for_chunk(mem2chunk(p))); return p; } +/* For ISO C11. */ +weak_alias (public_mEMALIGn, aligned_alloc) libc_hidden_def (public_mEMALIGn) void* diff --git a/stdio-common/tst-gets.c b/stdio-common/tst-gets.c index 87786f5b71..463f345e0e 100644 --- a/stdio-common/tst-gets.c +++ b/stdio-common/tst-gets.c @@ -1,5 +1,5 @@ /* Tests for gets. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2001. @@ -21,6 +21,11 @@ #include <stdio.h> #include <string.h> +/* The <stdio.h> header does not include the declaration for gets + anymore when compiling with _GNU_SOURCE. Provide a copy here. */ +extern char *gets (char *__s) |
