diff mbox

[libgo] : Fix build warning

Message ID CAFULd4ZZERu0EawpWBwoW3Rau7auNiB6HyY9i6epDRjg2JmNSg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 17, 2014, 9:54 a.m. UTC
On Tue, Dec 16, 2014 at 8:58 PM, 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.
>
> Please note that the above command also defines __USE_FILE_OFFSET64,
> but indeed, I don't see these warnings on Fedora 20.
>
>> 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?
>
> You are right, the proposed change was too broad. I am testing following patch:

The (now attached, to avoid mailer mangling) patch also fixes
mentioned build warnings.

Bootstrapped and regression tested on CentOS 5.11.

OK for mainline?

Uros.

Comments

Ian Lance Taylor Dec. 17, 2014, 2:27 p.m. UTC | #1
On Wed, Dec 17, 2014 at 1:54 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Dec 16, 2014 at 8:58 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> The (now attached, to avoid mailer mangling) patch also fixes
> mentioned build warnings.
>
> Bootstrapped and regression tested on CentOS 5.11.
>
> OK for mainline?

Thanks.  Committed.

Ian
diff mbox

Patch

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 218808)
+++ Makefile.in	(working copy)
@@ -4421,7 +4421,7 @@ 
 
 sysinfo.go: s-sysinfo; @true
 s-sysinfo: $(srcdir)/mksysinfo.sh config.h
-	CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
+	CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh
 	$(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
 	$(STAMP) $@
 
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 218808)
+++ Makefile.am	(working copy)
@@ -1812,7 +1812,7 @@ 
 
 sysinfo.go: s-sysinfo; @true
 s-sysinfo: $(srcdir)/mksysinfo.sh config.h
-	CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
+	CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh
 	$(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
 	$(STAMP) $@