This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sys/stat.h fix


Hi!

echo '#include <sys/stat.h>' | gcc -c -xc -
fails with:
In file included from /usr/include/sys/stat.h:101,
                 from <stdin>:1:
/usr/include/bits/stat.h:70: field `st_atim' has incomplete type
/usr/include/bits/stat.h:71: field `st_mtim' has incomplete type
/usr/include/bits/stat.h:72: field `st_ctim' has incomplete type

The problem is that time.h is included in sys/stat.h only if
__USE_XOPEN. The following patch reorganizes it so that
time.h is included even if defined __USE_MISC && !defined __USE_XOPEN
(in that case just with __need_timespec defined).

2003-01-01  Jakub Jelinek  <jakub@redhat.com>

	* io/sys/stat.h: Incldue time.h with __need_timespec even if
	__USE_MISC is defined but __USE_XOPEN is not.

--- libc/io/sys/stat.h.jj	2003-01-01 03:33:18.000000000 +0100
+++ libc/io/sys/stat.h	2003-01-02 00:36:11.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1995-2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995-2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,13 +27,17 @@
 
 #include <bits/types.h>		/* For __mode_t and __dev_t.  */
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_MISC
+# ifdef __USE_XOPEN
+#  define __need_time_t
+# endif
 # ifdef __USE_MISC
 #  define __need_timespec
 # endif
-# define __need_time_t
-# include <time.h>		/* For time_t.  */
+# include <time.h>		/* For time_t resp. timespec.  */
+#endif
 
+#ifdef __USE_XOPEN
 /* The Single Unix specification says that some more types are
    available here.  */
 # ifndef __dev_t_defined

	Jakub


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