public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix stdio.h namespace for pre-threads POSIX (bug 20014)
@ 2016-04-27 22:05 Joseph Myers
  2016-04-28 21:57 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2016-04-27 22:05 UTC (permalink / raw)
  To: libc-alpha

stdio.h declares flockfile, ftrylockfile, funlockfile, getc_unlocked,
getchar_unlocked, putc_unlocked and putchar_unlocked if __USE_POSIX,
with comments "These are defined in POSIX.1:1996.".  But __USE_POSIX
is actually POSIX.1:1990, and these functions should not be declared
for 1990 / 1992 / 1993 POSIX, XPG3 or XPG4.  This patch fixes stdio.h
to use __USE_POSIX199506 instead for those conditionals, as that is
the correct conditional for the version of POSIX that introduced
threads, and with threads those functions.

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

2016-04-27  Joseph Myers  <joseph@codesourcery.com>

	[BZ #20014]
	* libio/stdio.h (getc_unlocked): Declare if [__USE_POSIX199506],
	not [__USE_POSIX].
	(getchar_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(putchar_unlocked): Likewise.
	(flockfile): Likewise.
	(ftrylockfile): Likewise.
	(funlockfile): Likewise.
	* conform/Makefile (test-xfail-XPG3/stdio.h/conform): Remove
	variable.
	(test-xfail-XPG4/stdio.h/conform): Likewise.

diff --git a/conform/Makefile b/conform/Makefile
index 26264fc..209316c 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -170,7 +170,6 @@ test-xfail-XPG3/limits.h/conform = yes
 test-xfail-XPG3/pwd.h/conform = yes
 test-xfail-XPG3/search.h/conform = yes
 test-xfail-XPG3/signal.h/conform = yes
-test-xfail-XPG3/stdio.h/conform = yes
 test-xfail-XPG3/stdlib.h/conform = yes
 test-xfail-XPG3/string.h/conform = yes
 test-xfail-XPG3/sys/stat.h/conform = yes
@@ -185,7 +184,6 @@ test-xfail-XPG4/langinfo.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/stdio.h/conform = yes
 test-xfail-XPG4/stdlib.h/conform = yes
 test-xfail-XPG4/sys/stat.h/conform = yes
 test-xfail-XPG4/sys/time.h/conform = yes
diff --git a/libio/stdio.h b/libio/stdio.h
index d7dbfad..a48f150 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -544,7 +544,7 @@ __END_NAMESPACE_STD
    optimization for it.  */
 #define getc(_fp) _IO_getc (_fp)
 
-#ifdef __USE_POSIX
+#ifdef __USE_POSIX199506
 /* These are defined in POSIX.1:1996.
 
    These functions are possible cancellation points and therefore not
@@ -596,7 +596,7 @@ __END_NAMESPACE_STD
 extern int fputc_unlocked (int __c, FILE *__stream);
 #endif /* Use MISC.  */
 
-#ifdef __USE_POSIX
+#ifdef __USE_POSIX199506
 /* These are defined in POSIX.1:1996.
 
    These functions are possible cancellation points and therefore not
@@ -907,7 +907,7 @@ extern int obstack_vprintf (struct obstack *__restrict __obstack,
 #endif /* Use GNU.  */
 
 
-#ifdef __USE_POSIX
+#ifdef __USE_POSIX199506
 /* These are defined in POSIX.1:1996.  */
 
 /* Acquire ownership of STREAM.  */

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: Fix stdio.h namespace for pre-threads POSIX (bug 20014)
  2016-04-27 22:05 Fix stdio.h namespace for pre-threads POSIX (bug 20014) Joseph Myers
@ 2016-04-28 21:57 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2016-04-28 21:57 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

Approved

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

end of thread, other threads:[~2016-04-28 21:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 22:05 Fix stdio.h namespace for pre-threads POSIX (bug 20014) Joseph Myers
2016-04-28 21:57 ` 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).