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]

Fix swscanf vswscanf namespace (bug 18542)


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  <joseph@codesourcery.com>

	[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;

-- 
Joseph S. Myers
joseph@codesourcery.com


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