public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sys/stat.h fix
@ 2003-01-01 22:13 Jakub Jelinek
  2003-01-02  7:51 ` Andreas Jaeger
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2003-01-01 22:13 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath, aj; +Cc: Glibc hackers

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

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

* Re: [PATCH] sys/stat.h fix
  2003-01-01 22:13 [PATCH] sys/stat.h fix Jakub Jelinek
@ 2003-01-02  7:51 ` Andreas Jaeger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-01-02  7:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Roland McGrath, Glibc hackers

Jakub Jelinek <jakub@redhat.com> writes:

> 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).

Thanks, committed,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: [PATCH] sys/stat.h fix
  2000-06-30 14:17 Jakub Jelinek
@ 2000-06-30 22:01 ` Ulrich Drepper
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2000-06-30 22:01 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: libc-hacker, teg

Jakub Jelinek <jakub@redhat.com> writes:

> 2000-06-30  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* io/sys/stat.h (stat64, lstat64, fstat64): Don't define inlines
> 	if redirecting and either redirection is done using defines or
> 	not optimizing.

Thanks, I've applied the patch.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

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

* [PATCH] sys/stat.h fix
@ 2000-06-30 14:17 Jakub Jelinek
  2000-06-30 22:01 ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2000-06-30 14:17 UTC (permalink / raw)
  To: drepper; +Cc: libc-hacker, teg

Hi!

With current sys/stat.h it is impossible to compile a C++ program which
includes it and is compiled with -D_FILE_OFFSET_BITS=64
-D_LARGEFILE64_SOURCE. The reason is that C++ puts extern inlines into
linkonce section, but as e.g. both fstat and fstat64 have the same assembly
name (fstat64), it dies because there are two identical symbols in one
section. While fixing that, I've noticed that if __REDIRECT is not defined,
then it will die because there will be two inlines with the same name
(redefinition of `fstat64' will happen).

2000-06-30  Jakub Jelinek  <jakub@redhat.com>

	* io/sys/stat.h (stat64, lstat64, fstat64): Don't define inlines
	if redirecting and either redirection is done using defines or
	not optimizing.

--- libc/io/sys/stat.h.jj	Fri Jun 30 22:58:46 2000
+++ libc/io/sys/stat.h	Fri Jun 30 22:59:43 2000
@@ -360,7 +360,9 @@ extern __inline__ int mknod (__const cha
 }
 # endif
 
-# ifdef __USE_LARGEFILE64
+# if defined __USE_LARGEFILE64 && \
+  (! defined __USE_FILE_OFFSET64 || \
+   (defined __REDIRECT && defined __OPTIMIZE__))
 extern __inline__ int stat64 (__const char *__path,
 			      struct stat64 *__statbuf) __THROW
 {

	Jakub

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

end of thread, other threads:[~2003-01-02  7:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-01 22:13 [PATCH] sys/stat.h fix Jakub Jelinek
2003-01-02  7:51 ` Andreas Jaeger
  -- strict thread matches above, loose matches on Subject: below --
2000-06-30 14:17 Jakub Jelinek
2000-06-30 22:01 ` Ulrich Drepper

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).