diff mbox

Include all of <time.h> from <sched.h> for older standards (bug 16670)

Message ID Pine.LNX.4.64.1403071829530.6302@digraph.polyomino.org.uk
State Committed
Headers show

Commit Message

Joseph Myers March 7, 2014, 6:30 p.m. UTC
This patch fixes one of the header namespace issues shown up by
conformtest, <sched.h> failing to expose all symbols from <time.h> as
required by older standards.  The patch keeps the existing behavior if
__USE_XOPEN2K is defined (the default; POSIX.1-2001 was the version
that made it optional to expose these symbols), but ensures that all
the symbols from <time.h> are exposed if an older standard is
selected.  Tested x86_64.

2014-03-07  Joseph Myers  <joseph@codesourcery.com>

	[BZ #16670]
	* posix/sched.h [!__USE_XOPEN2K] (__need_time_t): Don't define
	before #include of <time.h>.
	[!__USE_XOPEN2K] (__need_timespec): Likewise.
	* conform/Makefile (test-xfail-POSIX/sched.h/conform): Remove.
	(test-xfail-UNIX98/sched.h/conform): Likewise.

Comments

Andreas Schwab March 7, 2014, 6:55 p.m. UTC | #1
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> 	[BZ #16670]
> 	* posix/sched.h [!__USE_XOPEN2K] (__need_time_t): Don't define
> 	before #include of <time.h>.
> 	[!__USE_XOPEN2K] (__need_timespec): Likewise.
> 	* conform/Makefile (test-xfail-POSIX/sched.h/conform): Remove.
> 	(test-xfail-UNIX98/sched.h/conform): Likewise.

Looks good.

Andreas.
diff mbox

Patch

diff --git a/conform/Makefile b/conform/Makefile
index 3e08728..e8c9a9a 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -188,7 +188,6 @@  test-xfail-XPG4/termios.h/conform = yes
 test-xfail-XPG4/ucontext.h/conform = yes
 test-xfail-XPG4/unistd.h/conform = yes
 test-xfail-XPG4/utmpx.h/conform = yes
-test-xfail-POSIX/sched.h/conform = yes
 test-xfail-POSIX/signal.h/conform = yes
 test-xfail-POSIX/sys/wait.h/conform = yes
 test-xfail-POSIX/tar.h/conform = yes
@@ -197,7 +196,6 @@  test-xfail-UNIX98/fcntl.h/conform = yes
 test-xfail-UNIX98/langinfo.h/conform = yes
 test-xfail-UNIX98/netdb.h/conform = yes
 test-xfail-UNIX98/netinet/in.h/conform = yes
-test-xfail-UNIX98/sched.h/conform = yes
 test-xfail-UNIX98/signal.h/conform = yes
 test-xfail-UNIX98/stdio.h/conform = yes
 test-xfail-UNIX98/stdlib.h/conform = yes
diff --git a/posix/sched.h b/posix/sched.h
index f7da255..779109a 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -27,8 +27,10 @@ 
 #define __need_size_t
 #include <stddef.h>
 
-#define __need_time_t
-#define __need_timespec
+#ifdef __USE_XOPEN2K
+# define __need_time_t
+# define __need_timespec
+#endif
 #include <time.h>
 
 #ifndef __pid_t_defined