Skip to content

Commit

Permalink
Fix __printf_fp wmemset namespace (bug 17574).
Browse files Browse the repository at this point in the history
__printf_fp calls wmemset, but that is not an ISO C90 function.  This
patch fixes it to call a new __wmemset name instead (with wmemset
being a weak alias).

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17574]
	* wcsmbs/wmemset.c (wmemset): Rename to __wmemset and define as
	weak alias of __wmemset.  Use libc_hidden_weak.
	(__wmemset): Use libc_hidden_def.
	* include/wchar.h (__wmemset): Declare.  Use libc_hidden_proto.
	* stdio-common/printf_fp.c (___printf_fp): Call __wmemset instead
	of wmemset.
  • Loading branch information
Joseph Myers committed Nov 12, 2014
1 parent 939da41 commit 01cad84
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
2014-11-12 Joseph Myers <joseph@codesourcery.com>

[BZ #17574]
* wcsmbs/wmemset.c (wmemset): Rename to __wmemset and define as
weak alias of __wmemset. Use libc_hidden_weak.
(__wmemset): Use libc_hidden_def.
* include/wchar.h (__wmemset): Declare. Use libc_hidden_proto.
* stdio-common/printf_fp.c (___printf_fp): Call __wmemset instead
of wmemset.

[BZ #17573]
* include/string.h [NOT_IN_libc || !SHARED] (mempcpy): Declare
with asm name __mempcpy.
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Version 2.21

6652, 12926, 14132, 14138, 14171, 15215, 15884, 17266, 17344, 17363,
17370, 17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522,
17555, 17570, 17571, 17572, 17573, 17583, 17584.
17555, 17570, 17571, 17572, 17573, 17574, 17583, 17584.

* New locales: tu_IN, bh_IN.

Expand Down
2 changes: 2 additions & 0 deletions include/wchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ libc_hidden_proto (wcschr)
libc_hidden_proto (wcscoll)
libc_hidden_proto (wcspbrk)

extern typeof (wmemset) __wmemset;
libc_hidden_proto (wmemchr)
libc_hidden_proto (wmemset)
libc_hidden_proto (__wmemset)

/* Now define the internal interfaces. */
extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
Expand Down
2 changes: 1 addition & 1 deletion stdio-common/printf_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ ___printf_fp (FILE *fp,
wstartp[1] = decimalwc;
if (wcp >= wstartp + 2)
{
wmemset (wstartp + 6, L'0', wcp - (wstartp + 2));
__wmemset (wstartp + 6, L'0', wcp - (wstartp + 2));
wcp += 4;
}
else
Expand Down
6 changes: 4 additions & 2 deletions wcsmbs/wmemset.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


wchar_t *
wmemset (s, c, n)
__wmemset (s, c, n)
wchar_t *s;
wchar_t c;
size_t n;
Expand Down Expand Up @@ -52,4 +52,6 @@ wmemset (s, c, n)

return s;
}
libc_hidden_def (wmemset)
libc_hidden_def (__wmemset)
weak_alias (__wmemset, wmemset)
libc_hidden_weak (wmemset)

0 comments on commit 01cad84

Please sign in to comment.