Message ID | CAFULd4Zm1GuVLn9pHb4rd817AG+RWN2kh=BHrNc-7WNjkwiELA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Dec 16, 2014 at 11:05 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > > When building libgo on CentOS 5.11, following warnings appear: > > In file included from /usr/include/fcntl.h:38:0, > from sysinfo.c:6: > /home/uros/gcc-build/gcc/include-fixed/sys/stat.h:317:16: warning: > inline function ‘lstat64’ declared but never defined > __inline__ int lstat64 (__const char *__restrict __file, > ^ > /home/uros/gcc-build/gcc/include-fixed/sys/stat.h:286:16: warning: > inline function ‘fstatat64’ declared but never defined > __inline__ int fstatat64 (int __fd, __const char *__restrict __file, > ^ > /home/uros/gcc-build/gcc/include-fixed/sys/stat.h:255:16: warning: > inline function ‘fstat64’ declared but never defined > __inline__ int fstat64 (int __fd, struct stat64 *__buf) __THROW > __nonnull ((2)); > ^ > /home/uros/gcc-build/gcc/include-fixed/sys/stat.h:250:16: warning: > inline function ‘stat64’ declared but never defined > __inline__ int stat64 (__const char *__restrict __file, > ^ > These are emitted from: > > CC="/home/uros/gcc-build/./gcc/xgcc -B/home/uros/gcc-build/./gcc/ > -B/usr/local/x86_64-unknown-linux-gnu/bin/ > -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/ > local/x86_64-unknown-linux-gnu/include -isystem > /usr/local/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. > -I../../../gcc-svn/trunk/libgo -I ../../../gcc-svn/trunk/libgo/run > time -I../../../gcc-svn/trunk/libgo/../libffi/include > -I../libffi/include -pthread -D_GNU_SOURCE -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64" /bin/sh ../../../gcc-svn/trunk/libgo/mksysin > fo.sh > > due to the sys/stat.h, which protects above functions with: > > # if defined __USE_LARGEFILE64 \ > && (! defined __USE_FILE_OFFSET64 \ > || (defined __REDIRECT_NTH && defined __OPTIMIZE__)) > > Adding -O to OSCFLAGS fixes this issue, as __OPTIMIZE__ is defined with -O. > > Patch was bootstrapped and regression tested on x86_64-linux-gnu > (CentOS 5.11), where it removes the above warnings. > > OK for mainline? This seems a bit dubious, as it seems that the same problem would occur for any C program that #include's <sys/stat.h> and is compiled without optimization. I don't mind passing -O when running mksysinfo.sh, but your patch will pass -O to all the C file compilations. That doesn't seem like a good idea--some people might want to debug that code. Can you try either only addding -O for CentOS, or addding it only to mksysinfo.sh? Ian
Index: configure =================================================================== --- configure (revision 218778) +++ configure (working copy) @@ -13968,7 +13968,7 @@ -OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O" case "$target" in mips-sgi-irix6.5*) # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct Index: configure.ac =================================================================== --- configure.ac (revision 218778) +++ configure.ac (working copy) @@ -349,7 +349,7 @@ AC_SUBST(GO_SYSCALL_OS_ARCH_FILE) dnl Special flags used to generate sysinfo.go. -OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O" case "$target" in mips-sgi-irix6.5*) # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct