# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../glibc/glibc-2.11.3-branch-update-26-gb72646a.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- diff --git a/ChangeLog b/ChangeLog index 49dcad6..3d76b4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,131 @@ +2011-02-02 Ulrich Drepper + + * elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the + function to the callback. + Patch partly by Jiri Olsa . + +2011-02-02 Andreas Schwab + + * shadow/sgetspent.c: Check return value of __sgetspent_r instead + of errno. + +2010-10-01 Andreas Schwab + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't discard result of + decoding ACE if AI_CANONIDN. + +2011-01-17 Ulrich Drepper + + * io/fcntl.h: Define AT_NO_AUTOMOUNT. + + * sysdeps/unix/sysv/linux/i386/bits/mman.h: Define MADV_HUGEPAGE and + MADV_NOHUGEPAGE. + * sysdeps/unix/sysv/linux/ia64/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/s390/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sh/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise. + * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Likewise. + + * sysdeps/unix/sysv/linux/bits/socket.h: Define AF_CAIF, AF_ALG, + PF_CAIF, and PF_ALG. + * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Likewise. + +2011-01-15 Ulrich Drepper + + [BZ #6812] + * nscd/hstcache.c (tryagain): Define. + (cache_addhst): Return tryagain not notfound for temporary errors. + (addhstbyX): Also set h_errno to TRY_AGAIN when memory allocation + failed. + +2011-01-13 Ulrich Drepper + + [BZ #12397] + * sysdeps/unix/sysv/linux/mkdirat.c (mkdirat): Fix handling of missing + syscall. + + [BZ #10484] + * nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Handle overflows of + temporary buffer used to handle multi lookups locally. + * include/alloca.h: Add libc_hidden_proto for __libc_alloca_cutoff. + +2011-01-12 Ulrich Drepper + + * elf/dl-dst.h (DL_DST_REQUIRED): Allow l_origin to be NULL when + loader is ld.so. + +2010-03-12 Andreas Schwab + + * elf/dl-dst.h: Include "trusted-dirs.h". + (DL_DST_REQUIRED): Take $LIB into account. + +2011-01-10 Paul Pluzhnikov + + * sysdeps/i386/Makefile: stdlib/cxa_finalize.c needs 16-byte stack + alignment for SSE2. + +2011-01-12 Ulrich Drepper + + [BZ #12394] + * stdio-common/printf_fp.c (__printf_fp): Add more room for grouping + characters. When rounding increased number of integer digits recompute + number of groups. + * stdio-common/tst-grouping.c: New file. + * stdio-common/Makefile: Add rules to build and run tst-grouping. + +2011-01-04 David S. Miller + + [BZ #11155] + * sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c: Use i386's + implementation just like for lxstat, fxstatat, et al. + +2010-12-27 Jim Meyering + + [BZ #12348] + * posix/regexec.c (build_trtable): Return failure indication upon + calloc failure. Otherwise, re_search_internal could infloop on OOM. + +2010-12-25 Ulrich Drepper + + [BZ #12207] + * malloc/malloc.c (do_check_malloc_state): Use fastbin macro. + +2010-12-19 Ulrich Drepper + + * sysdeps/unix/readdir_r.c (__READDIR_R): Compute reclen more + accurately. + * sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Define + GETDENTS_64BIT_ALIGNED. + +2010-12-10 Andreas Schwab + + * wcsmbs/wchar.h (wcpcpy, wcpncpy): Add __restrict. + * wcsmbs/bits/wchar2.h (__wmemmove_chk_warn, wmemmove, wmemset): + Remove __restrict. + (wcscpy, __wcpcpy_chk, __wcpcpy_alias, wcpcpy, wcsncpy, wcpncpy) + (wcscat, wcsncat, __wcrtomb_chk, wcrtomb): Add __restrict. + +2010-12-09 Ulrich Drepper + + [BZ #11655] + * stdlib/msort.c (qsort_r): Make sure both phys_pages and pagesize + are initialized. + +2010-12-09 Jakub Jelinek + + * string/bits/string3.h (memmove, bcopy): Remove __restrict. + +2010-11-30 Ulrich Drepper + + * sysdeps/i386/fpu/libm-test-ulps: Relax ynf(10,0.75) test expectations. + +2010-11-24 Andreas Schwab + + * resolv/nss_dns/dns-host.c (getanswer_r): Don't handle ttl == 0 + specially. + (gaih_getanswer_slice): Likewise. + 2010-05-31 Petr Baudis [BZ #11149] diff --git a/elf/dl-dst.h b/elf/dl-dst.h index 76076a6..9d219e2 100644 --- a/elf/dl-dst.h +++ b/elf/dl-dst.h @@ -1,6 +1,5 @@ /* Handling of dynamic sring tokens. - Copyright (C) 1999,2001,2002,2003,2004,2006,2007 - Free Software Foundation, Inc. + Copyright (C) 1999,2001-2004,2006,2007,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 @@ -18,6 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "trusted-dirs.h" + /* Determine the number of DST elements in the name. Only if IS_PATH is nonzero paths are recognized (i.e., multiple, ':' separated filenames). */ #define DL_DST_COUNT(name, is_path) \ @@ -31,6 +32,11 @@ __cnt; }) +#ifdef SHARED +# define IS_RTLD(l) (l) == &GL(dl_rtld_map) +#else +# define IS_RTLD(l) 0 +#endif /* Guess from the number of DSTs the length of the result string. */ #define DL_DST_REQUIRED(l, name, len, cnt) \ ({ \ @@ -39,28 +45,32 @@ \ if (__cnt > 0) \ { \ - size_t origin_len; \ + size_t dst_len; \ /* Now we make a guess how many extra characters on top of the \ length of S we need to represent the result. We know that \ we have CNT replacements. Each at most can use \ - MAX (strlen (ORIGIN), strlen (_dl_platform)) \ - minus 7 (which is the length of "$ORIGIN"). \ + MAX (MAX (strlen (ORIGIN), strlen (_dl_platform)), \ + strlen (DL_DST_LIB)) \ + minus 4 (which is the length of "$LIB"). \ \ First get the origin string if it is not available yet. \ - This can only happen for the map of the executable. */ \ + This can only happen for the map of the executable or, when \ + auditing, in ld.so. */ \ DL_DST_REQ_STATIC (l) \ if ((l)->l_origin == NULL) \ { \ - assert ((l)->l_name[0] == '\0'); \ + assert ((l)->l_name[0] == '\0' || IS_RTLD (l)); \ (l)->l_origin = _dl_get_origin (); \ - origin_len = ((l)->l_origin && (l)->l_origin != (char *) -1 \ + dst_len = ((l)->l_origin && (l)->l_origin != (char *) -1 \ ? strlen ((l)->l_origin) : 0); \ } \ else \ - origin_len = (l)->l_origin == (char *) -1 \ + dst_len = (l)->l_origin == (char *) -1 \ ? 0 : strlen ((l)->l_origin); \ - \ - __len += __cnt * (MAX (origin_len, GLRO(dl_platformlen)) - 7); \ + dst_len = MAX (MAX (dst_len, GLRO(dl_platformlen)), \ + strlen (DL_DST_LIB)); \ + if (dst_len > 4) \ + __len += __cnt * (dst_len - 4); \ } \ \ __len; }) @@ -72,7 +82,7 @@ if ((l) == NULL) \ { \ const char *origin = _dl_get_origin (); \ - origin_len = (origin && origin != (char *) -1 ? strlen (origin) : 0); \ + dst_len = (origin && origin != (char *) -1 ? strlen (origin) : 0); \ } \ else #endif diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c index 6847eda..ae2d05c 100644 --- a/elf/dl-runtime.c +++ b/elf/dl-runtime.c @@ -1,5 +1,5 @@ /* On-demand PLT fixup for shared objects. - Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1995-2009, 2010, 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 @@ -446,6 +446,7 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg, /* Set up the sym parameter. */ ElfW(Sym) sym = *defsym; + sym.st_value = DL_FIXUP_VALUE_ADDR (reloc_result->addr); /* Get the symbol name. */ const char *strtab = (const void *) D_PTR (reloc_result->bound, diff --git a/include/alloca.h b/include/alloca.h index 9a4b5c7..b99c3d1 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -14,6 +14,7 @@ extern void *__alloca (size_t __size); extern int __libc_use_alloca (size_t size) __attribute__ ((const)); extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const)); +libc_hidden_proto (__libc_alloca_cutoff) #define __MAX_ALLOCA_CUTOFF 65536 diff --git a/include/atomic.h b/include/atomic.h index 37d0111..fc4023b 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -33,7 +33,7 @@ the multi-thread case. The interfaces have the prefix "catomic_". - - support functions like barriers. They also have the preifx + - support functions like barriers. They also have the prefix "atomic_". Architectures must provide a few lowlevel macros (the compare diff --git a/io/fcntl.h b/io/fcntl.h index 2a2a29d..50559ca 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007, 2009 +/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007,2009,2010,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -64,6 +64,8 @@ __BEGIN_DECLS # define AT_REMOVEDIR 0x200 /* Remove directory instead of unlinking file. */ # define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ +# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount + traversal. */ # define AT_EACCESS 0x200 /* Test access permitted for effective IDs, not real IDs. */ #endif diff --git a/malloc/malloc.c b/malloc/malloc.c index 29c7992..8f5ab77 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2832,7 +2832,7 @@ static void do_check_malloc_state(mstate av) max_fast_bin = fastbin_index(get_max_fast ()); for (i = 0; i < NFASTBINS; ++i) { - p = av->fastbins[i]; + p = fastbin (av, i); /* The following test can only be performed for the main arena. While mallopt calls malloc_consolidate to get rid of all fast diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 73c65e6..aeb7183 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2011-01-13 Ulrich Drepper + + [BZ #10484] + * Versions [libc] (GLIBC_PRIVATE): Export __libc_alloca_cutoff. + * alloca_cutoff.c: Add libc_hidden_def. + 2010-08-12 H.J. Lu * nptl/sysdeps/unix/sysv/linux/i386/Makefile: New file. diff --git a/nptl/Versions b/nptl/Versions index 09098bf..285ff4c 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -27,6 +27,7 @@ libc { pthread_cond_broadcast; pthread_cond_timedwait; } GLIBC_PRIVATE { + __libc_alloca_cutoff; # Internal libc interface to libpthread __libc_dl_error_tsd; } diff --git a/nptl/alloca_cutoff.c b/nptl/alloca_cutoff.c index ba26ceb..bbd930a 100644 --- a/nptl/alloca_cutoff.c +++ b/nptl/alloca_cutoff.c @@ -1,5 +1,5 @@ /* Determine whether block of given size can be allocated on the stack or not. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 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 @@ -34,3 +34,4 @@ __libc_alloca_cutoff (size_t size) assume the maximum available stack space. */ ?: __MAX_ALLOCA_CUTOFF * 4)); } +libc_hidden_def (__libc_alloca_cutoff) diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 228f6fd..a6055cf 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -1,5 +1,5 @@ /* Cache handling for host lookup. - Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -77,6 +77,20 @@ static const hst_response_header notfound = }; +/* This is the standard reply in case there are temporary problems. */ +static const hst_response_header tryagain = +{ + .version = NSCD_VERSION, + .found = 0, + .h_name_len = 0, + .h_aliases_cnt = 0, + .h_addrtype = -1, + .h_length = -1, + .h_addr_list_cnt = 0, + .error = TRY_AGAIN +}; + + static void cache_addhst (struct database_dyn *db, int fd, request_header *req, const void *key, struct hostent *hst, uid_t owner, @@ -111,11 +125,15 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, else { /* We have no data. This means we send the standard reply for this - case. */ + case. Possibly this is only temporary. */ ssize_t total = sizeof (notfound); + assert (sizeof (notfound) == sizeof (tryagain)); + + const hst_response_header *resp = (errval == EAGAIN + ? &tryagain : ¬found); if (fd != -1 && - TEMP_FAILURE_RETRY (send (fd, ¬found, total, + TEMP_FAILURE_RETRY (send (fd, resp, total, MSG_NOSIGNAL)) != total) all_written = false; @@ -135,7 +153,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, ? db->negtimeout : ttl); /* This is the reply. */ - memcpy (&dataset->resp, ¬found, total); + memcpy (&dataset->resp, resp, total); /* Copy the key data. */ memcpy (dataset->strdata, key, req->key_len); @@ -490,6 +508,7 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req, /* We set the error to indicate this is (possibly) a temporary error and that it does not mean the entry is not available at all. */ + h_errno = TRY_AGAIN; errval = EAGAIN; break; } diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index e5f5b48..83de650 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -1,5 +1,5 @@ /* Hosts file parser in nss_files module. - Copyright (C) 1996-2001, 2003-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2003-2009, 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 @@ -129,19 +129,22 @@ _nss_files_get##name##_r (proto, \ && _res_hconf.flags & HCONF_FLAG_MULTI) \ { \ /* We have to get all host entries from the file. */ \ - const size_t tmp_buflen = MIN (buflen, 4096); \ - char tmp_buffer[tmp_buflen] \ + size_t tmp_buflen = MIN (buflen, 4096); \ + char tmp_buffer_stack[tmp_buflen] \ __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\ + char *tmp_buffer = tmp_buffer_stack; \ struct hostent tmp_result_buf; \ int naddrs = 1; \ int naliases = 0; \ char *bufferend; \ + bool tmp_buffer_malloced = false; \ \ while (result->h_aliases[naliases] != NULL) \ ++naliases; \ \ bufferend = (char *) &result->h_aliases[naliases + 1]; \ \ + again: \ while ((status = internal_getent (&tmp_result_buf, tmp_buffer, \ tmp_buflen, errnop H_ERRNO_ARG \ EXTRA_ARGS_VALUE)) \ @@ -182,7 +185,7 @@ _nss_files_get##name##_r (proto, \ } \ /* If the real name is different add it also to the \ aliases. This means that there is a duplication \ - in the alias list but this is really the users \ + in the alias list but this is really the user's \ problem. */ \ if (strcmp (old_result->h_name, \ tmp_result_buf.h_name) != 0) \ @@ -204,7 +207,7 @@ _nss_files_get##name##_r (proto, \ *errnop = ERANGE; \ *herrnop = NETDB_INTERNAL; \ status = NSS_STATUS_TRYAGAIN; \ - break; \ + goto out; \ } \ \ new_h_addr_list = \ @@ -268,8 +271,54 @@ _nss_files_get##name##_r (proto, \ } \ } \ \ - if (status != NSS_STATUS_TRYAGAIN) \ + if (status == NSS_STATUS_TRYAGAIN) \ + { \ + size_t newsize = 2 * tmp_buflen; \ + if (tmp_buffer_malloced) \ + { \ + char *newp = realloc (tmp_buffer, newsize); \ + if (newp != NULL) \ + { \ + assert ((((uintptr_t) newp) \ + & (__alignof__ (struct hostent_data) - 1)) \ + == 0); \ + tmp_buffer = newp; \ + tmp_buflen = newsize; \ + goto again; \ + } \ + } \ + else if (!__libc_use_alloca (buflen + newsize)) \ + { \ + tmp_buffer = malloc (newsize); \ + if (tmp_buffer != NULL) \ + { \ + assert ((((uintptr_t) tmp_buffer) \ + & (__alignof__ (struct hostent_data) - 1)) \ + == 0); \ + tmp_buffer_malloced = true; \ + tmp_buflen = newsize; \ + goto again; \ + } \ + } \ + else \ + { \ + tmp_buffer \ + = extend_alloca (tmp_buffer, tmp_buflen, \ + newsize \ + + __alignof__ (struct hostent_data)); \ + tmp_buffer = (char *) (((uintptr_t) tmp_buffer \ + + __alignof__ (struct hostent_data) \ + - 1) \ + & ~(__alignof__ (struct hostent_data)\ + - 1)); \ + goto again; \ + } \ + } \ + else \ status = NSS_STATUS_SUCCESS; \ + out: \ + if (tmp_buffer_malloced) \ + free (tmp_buffer); \ } \ \ \ diff --git a/posix/regexec.c b/posix/regexec.c index 8481b61..5019003 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -3347,6 +3347,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) { state->trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + if (BE (state->trtable == NULL, 0)) + return 0; return 1; } return 0; diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 8592183..fe4ac2d 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -599,7 +599,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, int (*name_ok) (const char *); u_char packtmp[NS_MAXCDNAME]; int have_to_map = 0; - int32_t ttl = 0; uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data); buffer += pad; if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0)) @@ -733,7 +732,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, cp += INT16SZ; /* type */ class = __ns_get16 (cp); cp += INT16SZ; /* class */ - ttl = __ns_get32 (cp); + int32_t ttl = __ns_get32 (cp); cp += INT32SZ; /* TTL */ n = __ns_get16 (cp); cp += INT16SZ; /* len */ @@ -907,7 +906,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, { register int nn; - if (ttlp != NULL && ttl != 0) + if (ttlp != NULL) *ttlp = ttl; if (canonp != NULL) *canonp = bp; @@ -1163,7 +1162,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname, if (*firstp) { - if (ttl != 0 && ttlp != NULL) + if (ttlp != NULL) *ttlp = ttl; (*pat)->name = canon ?: h_name; diff --git a/shadow/sgetspent.c b/shadow/sgetspent.c index ec7f384..f3dce53 100644 --- a/shadow/sgetspent.c +++ b/shadow/sgetspent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 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 @@ -49,8 +49,8 @@ sgetspent (const char *string) } while (buffer != NULL - && __sgetspent_r (string, &resbuf, buffer, buffer_size, &result) != 0 - && errno == ERANGE) + && (__sgetspent_r (string, &resbuf, buffer, buffer_size, &result) + == ERANGE)) { char *new_buf; buffer_size += BUFLEN_SPWD; diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 9cbf143..6aabfb6 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1991-2009, 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,7 +60,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ - scanf16 scanf17 tst-setvbuf1 + scanf16 scanf17 tst-setvbuf1 tst-grouping test-srcs = tst-unbputc tst-printf @@ -128,6 +128,7 @@ test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata scanf13-ENV = LOCPATH=$(common-objpfx)localedata bug14-ENV = LOCPATH=$(common-objpfx)localedata bug15-ENV = LOCPATH=$(common-objpfx)localedata +tst-grouping-ENV = LOCPATH=$(common-objpfx)localedata ifneq (,$(filter %REENTRANT, $(defines))) CPPFLAGS += -D_IO_MTSAFE_IO diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index b60ddec..e9ff168 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -1,5 +1,5 @@ /* Floating point output for `printf'. - Copyright (C) 1995-2003, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2006-2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper , 1995. @@ -884,7 +884,9 @@ ___printf_fp (FILE *fp, /* Guess the number of groups we will make, and thus how many spaces we need for separator characters. */ ngroups = __guess_grouping (intdig_max, grouping); - chars_needed += ngroups; + /* Allocate one more character in case rounding increases the + number of groups. */ + chars_needed += ngroups + 1; } /* Allocate buffer for output. We need two more because while rounding @@ -1088,9 +1090,16 @@ ___printf_fp (FILE *fp, --wcp; if (grouping) - /* Add in separator characters, overwriting the same buffer. */ - wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc, - ngroups); + { + /* Rounding might have changed the number of groups. We allocated + enough memory but we need here the correct number of groups. */ + if (intdig_no != intdig_max) + ngroups = __guess_grouping (intdig_no, grouping); + + /* Add in separator characters, overwriting the same buffer. */ + wcp = group_number (wstartp, wcp, intdig_no, grouping, thousands_sepwc, + ngroups); + } /* Write the exponent if it is needed. */ if (type != 'f') @@ -1210,7 +1219,7 @@ ___printf_fp (FILE *fp, tmpptr = buffer; if (__builtin_expect (info->i18n, 0)) - { + { #ifdef COMPILE_WPRINTF wstartp = _i18n_number_rewrite (wstartp, wcp, wbuffer + wbuffer_to_alloc); @@ -1224,7 +1233,7 @@ ___printf_fp (FILE *fp, assert ((uintptr_t) buffer <= (uintptr_t) tmpptr); assert ((uintptr_t) tmpptr < (uintptr_t) buffer_end); #endif - } + } PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr); diff --git a/stdio-common/tst-grouping.c b/stdio-common/tst-grouping.c new file mode 100644 index 0000000..e8f4b8c --- /dev/null +++ b/stdio-common/tst-grouping.c @@ -0,0 +1,83 @@ +/* BZ 12394, test by Bruno Haible. */ +#include +#include +#include +#include + + +static int +do_test (void) +{ + char buf1[1000]; + char buf2[1000]; + int result = 0; + + if (setlocale (LC_NUMERIC, "de_DE.UTF-8") == NULL) + return 1; + + sprintf (buf1, "%'.2f", 999.996); + sprintf (buf2, "%'.2f", 1000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 2; + + sprintf (buf1, "%'.2f", 999999.996); + sprintf (buf2, "%'.2f", 1000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 2; + + sprintf (buf1, "%'.2f", 999999999.996); + sprintf (buf2, "%'.2f", 1000000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 2; + + sprintf (buf1, "%'.2f", 999999999999.996); + sprintf (buf2, "%'.2f", 1000000000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 2; + + sprintf (buf1, "%'.2f", 999999999999999.996); + sprintf (buf2, "%'.2f", 1000000000000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 2; + + sprintf (buf1, "%'.5g", 999.996); + sprintf (buf2, "%'.5g", 1000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 4; + + sprintf (buf1, "%'.4g", 9999.996); + sprintf (buf2, "%'.4g", 10000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 8; + + sprintf (buf1, "%'.5g", 99999.996); + sprintf (buf2, "%'.5g", 100000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 8; + + sprintf (buf1, "%'.6g", 999999.996); + sprintf (buf2, "%'.6g", 1000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 8; + + sprintf (buf1, "%'.7g", 9999999.996); + sprintf (buf2, "%'.7g", 10000000.004); + printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2); + if (strcmp (buf1, buf2) != 0) + result |= 8; + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdlib/msort.c b/stdlib/msort.c index 35cd4d0..fc58f0d 100644 --- a/stdlib/msort.c +++ b/stdlib/msort.c @@ -25,6 +25,7 @@ #include #include #include +#include struct msort_param { @@ -182,7 +183,7 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg) static long int phys_pages; static int pagesize; - if (phys_pages == 0) + if (pagesize == 0) { phys_pages = __sysconf (_SC_PHYS_PAGES); @@ -197,6 +198,9 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg) a quarter of the physical memory. */ phys_pages /= 4; + /* Make sure phys_pages is written to memory. */ + atomic_write_barrier (); + pagesize = __sysconf (_SC_PAGESIZE); } diff --git a/string/bits/string3.h b/string/bits/string3.h index 1d759f1..1647725 100644 --- a/string/bits/string3.h +++ b/string/bits/string3.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2007, 2009, 2010 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 @@ -53,8 +53,7 @@ __NTH (memcpy (void *__restrict __dest, __const void *__restrict __src, } __extern_always_inline void * -__NTH (memmove (void *__restrict __dest, __const void *__restrict __src, - size_t __len)) +__NTH (memmove (void *__dest, __const void *__src, size_t __len)) { return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); } @@ -88,8 +87,7 @@ __NTH (memset (void *__dest, int __ch, size_t __len)) #ifdef __USE_BSD __extern_always_inline void -__NTH (bcopy (__const void *__restrict __src, void *__restrict __dest, - size_t __len)) +__NTH (bcopy (__const void *__src, void *__dest, size_t __len)) { (void) __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); } diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index ef45ce6..3d9f3fc 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -47,6 +47,7 @@ endif # And a couple of other routines ifeq ($(subdir),stdlib) CFLAGS-exit.c += -mpreferred-stack-boundary=4 +CFLAGS-cxa_finalize.c += -mpreferred-stack-boundary=4 endif ifeq ($(subdir),elf) CFLAGS-dl-init.c += -mpreferred-stack-boundary=4 diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 5231789..4b1a9e7 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -857,8 +857,8 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": -float: 1 -ifloat: 1 +float: 2 +ifloat: 2 ildouble: 4 ldouble: 4 Test "yn (10, 1.0) == -121618014.278689189288130426667971145": diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 8b7e38f..0217cc6 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -963,6 +963,7 @@ gaih_inet (const char *name, const struct gaih_service *service, make a copy. */ if (out == canon) goto make_copy; + canon = out; } else #endif diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c index 9372791..e166174 100644 --- a/sysdeps/unix/readdir_r.c +++ b/sysdeps/unix/readdir_r.c @@ -117,7 +117,8 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result) #ifdef GETDENTS_64BIT_ALIGNED /* The d_reclen value might include padding which is not part of the DIRENT_TYPE data structure. */ - reclen = MIN (reclen, sizeof (DIRENT_TYPE)); + reclen = MIN (reclen, + offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name)); #endif *result = memcpy (entry, dp, reclen); #ifdef GETDENTS_64BIT_ALIGNED diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index f23b338..d77e34b 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009 + Copyright (C) 1991, 1992, 1994-2001, 2004, 2006-2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -109,7 +109,9 @@ enum __socket_type #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ #define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ -#define PF_MAX 37 /* For now.. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -150,6 +152,8 @@ enum __socket_type #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET #define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h index 7ac1aff..10fbd7e 100644 --- a/sysdeps/unix/sysv/linux/i386/bits/mman.h +++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/i386 version. - Copyright (C) 1997,2000,2003,2005,2006,2009,2010 + Copyright (C) 1997,2000,2003,2005,2006,2009,2010,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -96,6 +96,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/ia64/bits/mman.h b/sysdeps/unix/sysv/linux/ia64/bits/mman.h index 1b278c7..8b13989 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/ia64 version. - Copyright (C) 1997,1998,2000,2003,2005,2006,2009 + Copyright (C) 1997,1998,2000,2003,2005,2006,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -95,6 +95,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c index aa89d08..73ebbe6 100644 --- a/sysdeps/unix/sysv/linux/mkdirat.c +++ b/sysdeps/unix/sysv/linux/mkdirat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 2009, 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 @@ -43,7 +43,7 @@ mkdirat (fd, file, mode) { res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode); # ifndef __ASSUME_ATFCTS - if (res == -1 && res == ENOSYS) + if (res == -1 && errno == ENOSYS) __have_atfcts = -1; else # endif diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h index e6580f8..c9b3f3f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/PowerPC version. - Copyright (C) 1997,2000,2003,2005,2006,2008,2009 + Copyright (C) 1997,2000,2003,2005,2006,2008,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -96,6 +96,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h index daeafd4..51053db 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/mman.h +++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/s390 version. - Copyright (C) 2000-2003,2005,2006,2009 Free Software Foundation, Inc. + Copyright (C) 2000-2003,2005,2006,2009,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 @@ -94,6 +94,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h index aee0011..2097358 100644 --- a/sysdeps/unix/sysv/linux/sh/bits/mman.h +++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SH version. - Copyright (C) 1997,1999,2000,2003,2005,2006,2009 + Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -94,6 +94,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h index 71a3aa6..c0ffb3a 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h @@ -1,5 +1,5 @@ /* Definitions for POSIX memory map interface. Linux/SPARC version. - Copyright (C) 1997,1999,2000,2003,2005,2006,2009 + Copyright (C) 1997,1999,2000,2003,2005,2006,2009,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -97,6 +97,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h index a148072..141ea27 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/socket.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h @@ -1,5 +1,5 @@ /* System-specific socket constants and types. Linux/SPARC version. - Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009 + Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -108,7 +108,9 @@ enum __socket_type #define PF_ISDN 34 /* mISDN sockets. */ #define PF_PHONET 35 /* Phonet sockets. */ #define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ -#define PF_MAX 37 /* For now.. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -149,6 +151,8 @@ enum __socket_type #define AF_ISDN PF_ISDN #define AF_PHONET PF_PHONET #define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. @@ -233,8 +237,8 @@ enum #define MSG_MORE MSG_MORE MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file - descriptor received through - SCM_RIGHTS. */ + descriptor received through + SCM_RIGHTS. */ #define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC }; diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c index 6b37477..e328ccb 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c @@ -1 +1 @@ -#include "../../fxstat.c" +#include "../../i386/fxstat.c" diff --git a/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c b/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c index adb92db..12ca1a1 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c +++ b/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c @@ -1,4 +1,5 @@ #define readdir64_r __no_readdir64_r_decl +#define GETDENTS_64BIT_ALIGNED 1 #include #undef readdir64_r weak_alias (__readdir_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h index 6f3ad0d..9829710 100644 --- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h +++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h @@ -1,5 +1,6 @@ /* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001,2003,2005,2006,2009,2010 Free Software Foundation, Inc. + Copyright (C) 2001,2003,2005,2006,2009,2010,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 @@ -96,6 +97,8 @@ # define MADV_DOFORK 11 /* Do inherit across fork. */ # define MADV_MERGEABLE 12 /* KSM may merge identical pages. */ # define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages. */ +# define MADV_HUGEPAGE 14 /* Worth backing with hugepages. */ +# define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ #endif diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h index 2ec4ce1..c38eaa3 100644 --- a/wcsmbs/bits/wchar2.h +++ b/wcsmbs/bits/wchar2.h @@ -1,5 +1,5 @@ /* Checking macros for wchar functions. - Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007, 2010 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,15 +60,13 @@ extern wchar_t *__REDIRECT_NTH (__wmemmove_alias, (wchar_t *__s1, __const wchar_t *__s2, size_t __n), wmemmove); extern wchar_t *__REDIRECT_NTH (__wmemmove_chk_warn, - (wchar_t *__restrict __s1, - __const wchar_t *__restrict __s2, size_t __n, - size_t __ns1), __wmemmove_chk) + (wchar_t *__s1, __const wchar_t *__s2, + size_t __n, size_t __ns1), __wmemmove_chk) __warnattr ("wmemmove called with length bigger than size of destination " "buffer"); __extern_always_inline wchar_t * -__NTH (wmemmove (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, - size_t __n)) +__NTH (wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)) { if (__bos0 (__s1) != (size_t) -1) { @@ -129,7 +127,7 @@ extern wchar_t *__REDIRECT_NTH (__wmemset_chk_warn, "buffer"); __extern_always_inline wchar_t * -__NTH (wmemset (wchar_t *__restrict __s, wchar_t __c, size_t __n)) +__NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) { if (__bos0 (__s) != (size_t) -1) { @@ -152,7 +150,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscpy_alias, __const wchar_t *__restrict __src), wcscpy); __extern_always_inline wchar_t * -__NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src)) +__NTH (wcscpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcscpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -160,14 +158,15 @@ __NTH (wcscpy (wchar_t *__dest, __const wchar_t *__src)) } -extern wchar_t *__wcpcpy_chk (wchar_t *__dest, __const wchar_t *__src, +extern wchar_t *__wcpcpy_chk (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src, size_t __destlen) __THROW; -extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, (wchar_t *__dest, - __const wchar_t *__src), - wcpcpy); +extern wchar_t *__REDIRECT_NTH (__wcpcpy_alias, + (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src), wcpcpy); __extern_always_inline wchar_t * -__NTH (wcpcpy (wchar_t *__dest, __const wchar_t *__src)) +__NTH (wcpcpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcpcpy_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -190,7 +189,8 @@ extern wchar_t *__REDIRECT_NTH (__wcsncpy_chk_warn, "buffer"); __extern_always_inline wchar_t * -__NTH (wcsncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) +__NTH (wcsncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src, + size_t __n)) { if (__bos (__dest) != (size_t) -1) { @@ -220,7 +220,8 @@ extern wchar_t *__REDIRECT_NTH (__wcpncpy_chk_warn, "buffer"); __extern_always_inline wchar_t * -__NTH (wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)) +__NTH (wcpncpy (wchar_t *__restrict __dest, __const wchar_t *__restrict __src, + size_t __n)) { if (__bos (__dest) != (size_t) -1) { @@ -243,7 +244,7 @@ extern wchar_t *__REDIRECT_NTH (__wcscat_alias, __const wchar_t *__restrict __src), wcscat); __extern_always_inline wchar_t * -__NTH (wcscat (wchar_t *__dest, __const wchar_t *__src)) +__NTH (wcscat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src)) { if (__bos (__dest) != (size_t) -1) return __wcscat_chk (__dest, __src, __bos (__dest) / sizeof (wchar_t)); @@ -260,7 +261,8 @@ extern wchar_t *__REDIRECT_NTH (__wcsncat_alias, size_t __n), wcsncat); __extern_always_inline wchar_t * -__NTH (wcsncat (wchar_t *__dest, __const wchar_t *__src, size_t __n)) +__NTH (wcsncat (wchar_t *__restrict __dest, __const wchar_t *__restrict __src, + size_t __n)) { if (__bos (__dest) != (size_t) -1) return __wcsncat_chk (__dest, __src, __n, @@ -428,14 +430,16 @@ fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) #endif -extern size_t __wcrtomb_chk (char *__s, wchar_t __wchar, mbstate_t *__p, - size_t __buflen) __THROW __wur; +extern size_t __wcrtomb_chk (char *__restrict __s, wchar_t __wchar, + mbstate_t *__restrict __p, + size_t __buflen) __THROW __wur; extern size_t __REDIRECT_NTH (__wcrtomb_alias, (char *__restrict __s, wchar_t __wchar, mbstate_t *__restrict __ps), wcrtomb) __wur; __extern_always_inline __wur size_t -__NTH (wcrtomb (char *__s, wchar_t __wchar, mbstate_t *__ps)) +__NTH (wcrtomb (char *__restrict __s, wchar_t __wchar, + mbstate_t *__restrict __ps)) { /* We would have to include to get a definition of MB_LEN_MAX. But this would only disturb the namespace. So we define our own diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index eb5b244..fc2c6a4 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -561,11 +561,13 @@ extern long double wcstold_l (__const wchar_t *__restrict __nptr, #ifdef __USE_XOPEN2K8 /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ -extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW; +extern wchar_t *wcpcpy (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src) __THROW; /* Copy no more than N characters of SRC to DEST, returning the address of the last character written into DEST. */ -extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n) +extern wchar_t *wcpncpy (wchar_t *__restrict __dest, + __const wchar_t *__restrict __src, size_t __n) __THROW; #endif /* use GNU */