From patchwork Wed Dec 17 09:54:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 422218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A4B18140082 for ; Wed, 17 Dec 2014 20:54:13 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=pKZhNopPklnb+JN9vw jt7RzSmiV3h2XlTXF3M4pFe12jkR+XJ8oknTsbauBZgniC9PqqnMA11dxLVV0pQs /G5H+Vnyq8+eNYd/tBfDQoHMy4m/krbYDWeSf8ITqzkYvy+0r13yq3Dd3d66jiE/ 3gBpZEgRBxi5r0UdqtNokZOm4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=9f/YC7qRsQ/6d04tE4JxtXqK gqE=; b=CuFnp3Rbk5fYiFkLdteWw5WV9cI78knKpHu0/wVElLbNuob3BZJGl3QS pkKrYjL2FDMvsVpR1IpFTPhXydATN5csGbRztNK78htvhSGr/QlS2uUKBtP2b/6F PbpCwf2VcaEH91ylzhTvWnB0ePwKFhymtN3gW7BRd1LsEoO5vPs= Received: (qmail 7028 invoked by alias); 17 Dec 2014 09:54:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 7019 invoked by uid 89); 17 Dec 2014 09:54:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f48.google.com Received: from mail-oi0-f48.google.com (HELO mail-oi0-f48.google.com) (209.85.218.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 17 Dec 2014 09:54:02 +0000 Received: by mail-oi0-f48.google.com with SMTP id u20so10760511oif.7 for ; Wed, 17 Dec 2014 01:54:00 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.60.155.243 with SMTP id vz19mr13376344oeb.15.1418810040771; Wed, 17 Dec 2014 01:54:00 -0800 (PST) Received: by 10.60.69.73 with HTTP; Wed, 17 Dec 2014 01:54:00 -0800 (PST) In-Reply-To: References: Date: Wed, 17 Dec 2014 10:54:00 +0100 Message-ID: Subject: Re: [PATCH, libgo]: Fix build warning From: Uros Bizjak To: Ian Lance Taylor Cc: "gcc-patches@gcc.gnu.org" , "gofrontend-dev@googlegroups.com" On Tue, Dec 16, 2014 at 8:58 PM, Uros Bizjak 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 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. 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) $@