about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-02 20:23:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-02 20:23:09 +0000
commitbb4acb522c9206b8476a88be44606bf1bc1e96f6 (patch)
tree70c177bb3a964f12862f22969b4f0726a94e15e5 /posix
parent6cfae52edfb487ca3b78336a061acb6694338f72 (diff)
downloadglibc-bb4acb522c9206b8476a88be44606bf1bc1e96f6.tar.gz
glibc-bb4acb522c9206b8476a88be44606bf1bc1e96f6.tar.xz
glibc-bb4acb522c9206b8476a88be44606bf1bc1e96f6.zip
Fix fnmatch towlower namespace (bug 18469).
fnmatch brings in references to towlower (and thereby towupper), which
isn't in all the standards that contain fnmatch, resulting in
linknamespace test failures.  (This is contrary to glibc conventions,
rather than a standards conformance issue, because of the to*
reservation.)  This patch fixes this in the usual way, making those
functions into weak aliases.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).  This is on top
of <https://sourceware.org/ml/libc-alpha/2015-06/msg00019.html>, but
the two patches should be independent.

(The __attribute_pure__ on the declarations in include/wctype.h comes
from GCC's built-in attributes for towlower and towupper, and is
needed to get the same code generation for fnmatch before and after
the patch.  It seems likely there are cases where the declaration of
__foo in the internal headers is missing attributes from foo in the
public headers, built-in to GCC or both, but I don't know a good way
to detect such missing attributes.)

	[BZ #18469]
	* wctype/wcfuncs.c (towlower): Rename to __towlower and define as
	weak alias of __towlower.  Use libc_hidden_weak.
	(towupper): Rename to __towupper and define as weak alias of
	__towupper.  Use libc_hidden_weak.
	* include/wctype.h (__towlower): Declare.  Use libc_hidden_proto.
	(__towupper): Likewise.
	* posix/fnmatch.c [HANDLE_MULTIBYTE && _LIBC] (FOLD): Use
	__towlower instead of towlower.
Diffstat (limited to 'posix')
-rw-r--r--posix/fnmatch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index a707847dcc..7480ec7f00 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -229,7 +229,7 @@ __wcschrnul (s, c)
 # if HANDLE_MULTIBYTE
 /* Note that this evaluates C many times.  */
 #  ifdef _LIBC
-#   define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
+#   define FOLD(c) ((flags & FNM_CASEFOLD) ? __towlower (c) : (c))
 #  else
 #   define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? towlower (c) : (c))
 #  endif