From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.devel Subject: alloca() warnings on freebsd Date: Tue, 10 Aug 2010 01:09:44 +0300 Message-ID: <87ocdbbfpz.fsf@kobe.laptop> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1281391826 16465 80.91.229.12 (9 Aug 2010 22:10:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 Aug 2010 22:10:26 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 10 00:10:24 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OiaY4-0003Qr-9j for ged-emacs-devel@m.gmane.org; Tue, 10 Aug 2010 00:10:24 +0200 Original-Received: from localhost ([127.0.0.1]:40325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OiaY3-0002U5-OF for ged-emacs-devel@m.gmane.org; Mon, 09 Aug 2010 18:10:23 -0400 Original-Received: from [140.186.70.92] (port=37523 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OiaXx-0002RU-TX for emacs-devel@gnu.org; Mon, 09 Aug 2010 18:10:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OiaXw-00043j-GH for emacs-devel@gnu.org; Mon, 09 Aug 2010 18:10:17 -0400 Original-Received: from igloo.linux.gr ([62.1.205.36]:37348) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OiaXw-00043K-1W for emacs-devel@gnu.org; Mon, 09 Aug 2010 18:10:16 -0400 X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.001, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_40 -0.00) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: o79M9o6C024178 Original-Received: from kobe.laptop (178.128.133.200.dsl.dyn.forthnet.gr [178.128.133.200]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-9.1) with ESMTP id o79M9o6C024178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 10 Aug 2010 01:09:58 +0300 Original-Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.4/8.14.4) with ESMTP id o79M9jZv031102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 10 Aug 2010 01:09:45 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Original-Received: (from keramida@localhost) by kobe.laptop (8.14.4/8.14.4/Submit) id o79M9iKx031095; Tue, 10 Aug 2010 01:09:44 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:128516 Archived-At: Some time during the recent past an alloca() prototype was introduced to config.h that conflicts with the stdlib.h prototype of alloca() on my FreeBSD laptop. The current check near line 1148 of config.in is: #ifdef HAVE_ALLOCA_H # include #elif defined __GNUC__ # define alloca __builtin_alloca #elif defined _AIX # define alloca __alloca #else # include # ifdef __cplusplus extern "C" # endif void *alloca (size_t); #endif The tricky bit is that FreeBSD *does* have alloca() but not alloca.h, so the final #else part declares a redundant prototype. This causes a very minor but frequent warning for all source files that include config.h: In file included from /hg/emacs/gker/lib-src/test-distrib.c:23: ../src/config.h:1152:1: warning: "alloca" redefined In file included from ../src/config.h:1146, from /hg/emacs/gker/lib-src/test-distrib.c:23: /usr/include/stdlib.h:233:1: warning: this is the location of the previous definition ... The attached patch is an attempt to fix this for FreeBSD without breaking alloca() on other platforms. Does it look ok for trunk? %%% diff -r eb8d82184a6f -r c422057d6385 ChangeLog --- a/ChangeLog Mon Aug 09 10:08:56 2010 -0700 +++ b/ChangeLog Tue Aug 10 01:06:38 2010 +0300 @@ -1,3 +1,9 @@ +2010-08-09 Giorgos Keramidas + + * configure.in: Avoid declaring a redundant prototype of alloca() + when we HAVE_ALLOCA but not HAVE_ALLOCA_H (e.g. on FreeBSD systems + where alloca() is declared in stdlib.h). + 2010-08-09 Dan Nicolaescu * configure.in (ORDINARY_LINK): Use on hpux* too. diff -r eb8d82184a6f -r c422057d6385 configure.in --- a/configure.in Mon Aug 09 10:08:56 2010 -0700 +++ b/configure.in Tue Aug 10 01:06:38 2010 +0300 @@ -3574,16 +3574,18 @@ SYSTEM_PURESIZE_EXTRA seems like the lea #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#else -# include -# ifdef __cplusplus +#elif !defined(HAVE_ALLOCA) +# if defined __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# else +# include +# ifdef __cplusplus extern "C" +# endif +void *alloca (size_t); # endif -void *alloca (size_t); #endif #ifndef HAVE_SIZE_T diff -r eb8d82184a6f -r c422057d6385 src/ChangeLog --- a/src/ChangeLog Mon Aug 09 10:08:56 2010 -0700 +++ b/src/ChangeLog Tue Aug 10 01:06:38 2010 +0300 @@ -1,3 +1,9 @@ +2010-08-09 Giorgos Keramidas + + * config.in: Avoid declaring a redundant prototype of alloca() + when we HAVE_ALLOCA but not HAVE_ALLOCA_H (e.g. on FreeBSD systems + where alloca() is declared in stdlib.h). + 2010-08-09 Dan Nicolaescu Use const char* instead of char*. diff -r eb8d82184a6f -r c422057d6385 src/config.in --- a/src/config.in Mon Aug 09 10:08:56 2010 -0700 +++ b/src/config.in Tue Aug 10 01:06:38 2010 +0300 @@ -1147,16 +1147,18 @@ SYSTEM_PURESIZE_EXTRA seems like the lea #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#else -# include -# ifdef __cplusplus +#elif !defined(HAVE_ALLOCA) +# if defined __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# else +# include +# ifdef __cplusplus extern "C" +# endif +void *alloca (size_t); # endif -void *alloca (size_t); #endif #ifndef HAVE_SIZE_T %%%