From patchwork Mon Jun 15 22:57:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 484621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 097B2140273 for ; Tue, 16 Jun 2015 08:57:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=dRldcSv9; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=q4Db3AE17nZx6ceFBCL432wZg/R4r EWLKFXzMnWh6Tn8YoYhLpj8IGup0ZxFeM941gl3uoadVqcvcy47BRDvbWCdlhS1w c3TqlOfi1ZbhUGakIGmvN1JAFiJ+4KSE1cLZlck8PDC5x+0F+w9HTgCEvDqkB+b/ qCKN+/J/5k9yBY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=sBiEY/zE4DnXbzgLIH0mkHfKom8=; b=dRl dcSv9cVG0mhlNckSmnEe+MnSfYCF/2/uD0XL2JHZC856ysbyYvwNi+GFdeqIB04a rG4FkWKkDXG+2+kX9exckiAr9MdMr1qpCZp7DU+z1lttFzVbmNylXm+jRWDTMzBK uC7zNJ0+Whda6cxTM2BCEAC6jmXvVZKoKGTJl7Mk= Received: (qmail 56550 invoked by alias); 15 Jun 2015 22:57:45 -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 56541 invoked by uid 89); 15 Jun 2015 22:57:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Mon, 15 Jun 2015 22:57:38 +0000 From: Joseph Myers To: Subject: Fix swscanf vswscanf namespace (bug 18542) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 swscanf (added in C90 Amendment 1, present in UNIX98) calls vswscanf (added in C99, not in C90 Amendment 1 or UNIX98). This patch fixes this by using __vswscanf instead and making vswscanf into a weak alias. (I intend to add conform/ test support for C90 Amendment 1 - and various other standard versions supported by glibc but not yet by conform/ tests - at some point, once the results for currently tested standards are cleaner.) Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). 2015-06-15 Joseph Myers [BZ #18542] * libio/iovswscanf.c (__vswscanf): Use libc_hidden_def. (vswscanf) Use ldbl_weak_alias instead of ldbl_strong_alias * include/wchar.h (__vswscanf): Declare. Use libc_hidden_proto. * libio/swscanf.c (__swscanf): Call __vswscanf instead of vswscanf. * conform/Makefile (test-xfail-UNIX98/wchar.h/linknamespace): Remove variable. diff --git a/conform/Makefile b/conform/Makefile index 32d2985..0b06103 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -348,4 +348,3 @@ test-xfail-XPG3/unistd.h/linknamespace = yes test-xfail-XPG4/unistd.h/linknamespace = yes test-xfail-POSIX/mqueue.h/linknamespace = yes test-xfail-UNIX98/mqueue.h/linknamespace = yes -test-xfail-UNIX98/wchar.h/linknamespace = yes diff --git a/include/wchar.h b/include/wchar.h index 449ad1d..67d0248 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -197,7 +197,11 @@ extern int __isoc99_vwscanf (const wchar_t *__restrict __format, extern int __isoc99_vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, __gnuc_va_list __arg) __THROW; +extern int __vswscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW; libc_hidden_proto (__isoc99_vswscanf) +libc_hidden_proto (__vswscanf) libc_hidden_proto (__isoc99_vfwscanf) /* Internal functions. */ diff --git a/libio/iovswscanf.c b/libio/iovswscanf.c index 7ee3597..a228641 100644 --- a/libio/iovswscanf.c +++ b/libio/iovswscanf.c @@ -43,5 +43,6 @@ __vswscanf (const wchar_t *string, const wchar_t *format, _IO_va_list args) ret = _IO_vfwscanf ((_IO_FILE *) &sf._sbf, format, args, NULL); return ret; } +libc_hidden_def (__vswscanf) ldbl_hidden_def (__vswscanf, vswscanf) -ldbl_strong_alias (__vswscanf, vswscanf) +ldbl_weak_alias (__vswscanf, vswscanf) diff --git a/libio/swscanf.c b/libio/swscanf.c index 9e4c256..397dbc5 100644 --- a/libio/swscanf.c +++ b/libio/swscanf.c @@ -28,7 +28,7 @@ __swscanf (const wchar_t *s, const wchar_t *format, ...) int done; va_start (arg, format); - done = vswscanf (s, format, arg); + done = __vswscanf (s, format, arg); va_end (arg); return done;