public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix stdlib.h rand_r namespace (bug 20074)
@ 2016-05-10 22:39 Joseph Myers
  2016-05-20 22:13 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2016-05-10 22:39 UTC (permalink / raw)
  To: libc-alpha

stdlib.h declares rand_r if __USE_POSIX; i.e., POSIX.1:1990.  But
rand_r was added along with threads, so the condition should be
__USE_POSIX199506.  This patch corrects the condition.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[The XFAIL removal depends on
<https://sourceware.org/ml/libc-alpha/2016-05/msg00093.html> (pending
review) to eliminate the other cause of failure for the test in
question.]

2016-05-10  Joseph Myers  <joseph@codesourcery.com>

	[BZ #20074]
	* stdlib/stdlib.h (rand_r): Declare if [__USE_POSIX199506], not if
	[__USE_POSIX].
	* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove
	variable.

diff --git a/conform/Makefile b/conform/Makefile
index 8d381fb..47f2eb4 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -180,7 +180,6 @@ test-xfail-XPG4/fcntl.h/conform = yes
 test-xfail-XPG4/netdb.h/conform = yes
 test-xfail-XPG4/netinet/in.h/conform = yes
 test-xfail-XPG4/signal.h/conform = yes
-test-xfail-XPG4/stdlib.h/conform = yes
 test-xfail-XPG4/sys/stat.h/conform = yes
 test-xfail-XPG4/sys/wait.h/conform = yes
 test-xfail-XPG4/termios.h/conform = yes
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 5c0c982..ad9c6c8 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -337,7 +337,7 @@ extern int rand (void) __THROW;
 extern void srand (unsigned int __seed) __THROW;
 __END_NAMESPACE_STD
 
-#ifdef __USE_POSIX
+#ifdef __USE_POSIX199506
 /* Reentrant interface according to POSIX.1.  */
 extern int rand_r (unsigned int *__seed) __THROW;
 #endif

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix stdlib.h rand_r namespace (bug 20074)
  2016-05-10 22:39 Fix stdlib.h rand_r namespace (bug 20074) Joseph Myers
@ 2016-05-20 22:13 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2016-05-20 22:13 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

OK

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-20 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 22:39 Fix stdlib.h rand_r namespace (bug 20074) Joseph Myers
2016-05-20 22:13 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).