This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: (fhandler_base::lseek): Include high order bits in return.
On Sat, Nov 22, 2003 at 08:28:13PM -0500, Christopher Faylor wrote:
> The patch below causes compile warnings to be issued for cygwin when
> stat.h is included:
>
> In file included from /netrel/generic/cygwin/newlib/libc/include/sys/fcntl.h:164,
> from /netrel/generic/cygwin/winsup/cygwin/include/fcntl.h:14,
> from /netrel/generic/cygwin/winsup/testsuite/winsup.api/crlf.c:144:
> /netrel/generic/cygwin/newlib/libc/include/sys/stat.h:144: warning: `struct stat64' declared inside parameter list
> /netrel/generic/cygwin/newlib/libc/include/sys/stat.h:144: warning: its scope is only this definition or declaration, which is probably not what you want
>
> It could presumably cause errors for unistd.h/_lseek64 as well.
>
> I noticed this problem while trying to run the cygwin test suite.
These declarations should really only exist when building newlib.
They are not for building applications. I'd propose the below patch:
Corinna
* libc/include/fcntl.h: Declare syscalls only when building newlib.
* libc/include/stat.h: Ditto.
* libc/include/unistd.h: Ditto.
Index: libc/include/sys/fcntl.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/fcntl.h,v
retrieving revision 1.3
diff -u -p -r1.3 fcntl.h
--- libc/include/sys/fcntl.h 18 Nov 2003 19:17:17 -0000 1.3
+++ libc/include/sys/fcntl.h 24 Nov 2003 14:59:03 -0000
@@ -169,10 +169,12 @@ extern int fcntl _PARAMS ((int, int, ...
/* Provide _<systemcall> prototypes for functions provided by some versions
of newlib. */
+#ifdef _COMPILING_NEWLIB
extern int _open _PARAMS ((const char *, int, ...));
extern int _fcntl _PARAMS ((int, int, ...));
#ifdef __LARGE64_FILES
extern int _open64 _PARAMS ((const char *, int, ...));
+#endif
#endif
#ifdef __cplusplus
Index: libc/include/sys/stat.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/stat.h,v
retrieving revision 1.14
diff -u -p -r1.14 stat.h
--- libc/include/sys/stat.h 18 Nov 2003 19:17:17 -0000 1.14
+++ libc/include/sys/stat.h 24 Nov 2003 14:59:04 -0000
@@ -137,7 +137,7 @@ int _EXFUN(mknod,( const char *__path, m
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
-#ifndef __INSIDE_CYGWIN__
+#ifdef _COMPILING_NEWLIB
int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
#ifdef __LARGE64_FILES
Index: libc/include/sys/unistd.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/unistd.h,v
retrieving revision 1.46
diff -u -p -r1.46 unistd.h
--- libc/include/sys/unistd.h 18 Nov 2003 19:17:17 -0000 1.46
+++ libc/include/sys/unistd.h 24 Nov 2003 14:59:04 -0000
@@ -165,6 +165,7 @@ extern char *suboptarg; /* getsubopt(3
int getsubopt(char **, char * const *, char **);
#endif /* _POSIX_SOURCE */
+#ifdef _COMPILING_NEWLIB
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
int _EXFUN(_close, (int __fildes ));
@@ -180,6 +181,7 @@ void * _EXFUN(_sbrk, (ptrdiff_t __incr
int _EXFUN(_unlink, (const char *__path ));
_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte ));
int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] ));
+#endif
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__sh__)
#if !defined(__INSIDE_CYGWIN__)
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.