This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix fnmatch wmemchr namespace (bug 18468)


On 06/01/2015 01:47 PM, Joseph Myers wrote:
> fnmatch brings in references to wmemchr, which isn't in all the
> standards that contain fnmatch, resulting in linknamespace test
> failures.  This patch fixes this in the usual way, making wmemchr into
> a weak alias for __wmemchr.
> 
> Tested for x86_64 and x86 (testsuite, and that disassembly of
> installed shared libraries is unchanged by the patch).
> 
> 2015-06-01  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #18468]
> 	* wcsmbs/wmemchr.c (wmemchr): Rename to __wmemchr and define as
> 	weak alias of __wmemchr.  Use libc_hidden_weak.
> 	* include/wchar.h (__wmemchr): Declare.  Use libc_hidden_proto.
> 	* posix/fnmatch.c [HANDLE_MULTIBYTE] (MEMCHR): Use __wmemchr
> 	instead of wmemchr.

Looks good to me. Thanks for continuing to fix these.

> diff --git a/include/wchar.h b/include/wchar.h
> index 7b5e1a1..eb1cb0d 100644
> --- a/include/wchar.h
> +++ b/include/wchar.h
> @@ -87,7 +87,7 @@ libc_hidden_proto (wcsspn)
>  libc_hidden_proto (wcschr)
>  /* The C++ overloading of wcschr means we have to repeat the type to
>     declare __wcschr instead of using typeof, to avoid errors in C++
> -   tests.  */
> +   tests.  The same applies to __wmemchr.  */
>  extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
>       __THROW __attribute_pure__;
>  libc_hidden_proto (__wcschr)
> @@ -95,7 +95,10 @@ libc_hidden_proto (wcscoll)
>  libc_hidden_proto (wcspbrk)
>  
>  extern typeof (wmemset) __wmemset;
> +extern wchar_t *__wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
> +     __THROW __attribute_pure__;
>  libc_hidden_proto (wmemchr)
> +libc_hidden_proto (__wmemchr)
>  libc_hidden_proto (wmemset)
>  libc_hidden_proto (__wmemset)
>  
> diff --git a/posix/fnmatch.c b/posix/fnmatch.c
> index a707847..dffc5b7 100644
> --- a/posix/fnmatch.c
> +++ b/posix/fnmatch.c
> @@ -245,7 +245,7 @@ __wcschrnul (s, c)
>  #  define STRLEN(S) __wcslen (S)
>  #  define STRCAT(D, S) __wcscat (D, S)
>  #  define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
> -#  define MEMCHR(S, C, N) wmemchr (S, C, N)
> +#  define MEMCHR(S, C, N) __wmemchr (S, C, N)
>  #  define STRCOLL(S1, S2) wcscoll (S1, S2)
>  #  define WIDE_CHAR_VERSION 1
>  /* Change the name the header defines so it doesn't conflict with
> diff --git a/wcsmbs/wmemchr.c b/wcsmbs/wmemchr.c
> index 5c74d93..266950c 100644
> --- a/wcsmbs/wmemchr.c
> +++ b/wcsmbs/wmemchr.c
> @@ -19,7 +19,7 @@
>  #include <wchar.h>
>  
>  wchar_t *
> -wmemchr (s, c, n)
> +__wmemchr (s, c, n)
>       const wchar_t *s;
>       wchar_t c;
>       size_t n;
> @@ -59,4 +59,6 @@ wmemchr (s, c, n)
>  
>    return NULL;
>  }
> -libc_hidden_def (wmemchr)
> +libc_hidden_def (__wmemchr)
> +weak_alias (__wmemchr, wmemchr)
> +libc_hidden_weak (wmemchr)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]