From patchwork Mon Nov 10 18:38:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 3641 Received: (qmail 28932 invoked by alias); 10 Nov 2014 18:38:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 28849 invoked by uid 89); 10 Nov 2014 18:38:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Mon, 10 Nov 2014 18:38:08 +0000 From: Joseph Myers To: Subject: Fix __printf_fp wmemset namespace (bug 17574) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 __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), so fixing one of the bugs shown in the sample output of my proposed tests for such namespace issues . Tested for x86_64 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). 2014-11-10 Joseph Myers [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. diff --git a/include/wchar.h b/include/wchar.h index f927a95..8207a53 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -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) diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index c8061cb..406180c 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -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 diff --git a/wcsmbs/wmemset.c b/wcsmbs/wmemset.c index c499545..a80b815 100644 --- a/wcsmbs/wmemset.c +++ b/wcsmbs/wmemset.c @@ -20,7 +20,7 @@ wchar_t * -wmemset (s, c, n) +__wmemset (s, c, n) wchar_t *s; wchar_t c; size_t n; @@ -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)