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: Re: alloca() warnings on freebsd Date: Tue, 07 Sep 2010 22:01:16 +0300 Message-ID: <87lj7dnzsz.fsf@kobe.laptop> References: <87ocdbbfpz.fsf@kobe.laptop> <87lj8else1.fsf@kobe.laptop> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1283886118 13494 80.91.229.12 (7 Sep 2010 19:01:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Sep 2010 19:01:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 07 21:01:56 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 1Ot3Qa-0000EV-01 for ged-emacs-devel@m.gmane.org; Tue, 07 Sep 2010 21:01:56 +0200 Original-Received: from localhost ([127.0.0.1]:44119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot3QZ-00061y-C4 for ged-emacs-devel@m.gmane.org; Tue, 07 Sep 2010 15:01:55 -0400 Original-Received: from [140.186.70.92] (port=59103 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot3QT-000601-5T for emacs-devel@gnu.org; Tue, 07 Sep 2010 15:01:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ot3QR-0004Tv-L6 for emacs-devel@gnu.org; Tue, 07 Sep 2010 15:01:48 -0400 Original-Received: from igloo.linux.gr ([62.1.205.36]:58718) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ot3QR-0004SI-7U; Tue, 07 Sep 2010 15:01:47 -0400 X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: o87J1MHl021767 Original-Received: from kobe.laptop (178.128.0.202.dsl.dyn.forthnet.gr [178.128.0.202]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-9.2) with ESMTP id o87J1MHl021767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 7 Sep 2010 22:01:36 +0300 Original-Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.4/8.14.4) with ESMTP id o87J1Hi7012858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 22:01:17 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Original-Received: (from keramida@localhost) by kobe.laptop (8.14.4/8.14.4/Submit) id o87J1Gj7012855; Tue, 7 Sep 2010 22:01:16 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) In-Reply-To: <87lj8else1.fsf@kobe.laptop> (Giorgos Keramidas's message of "Tue, 10 Aug 2010 12:38:14 +0300") 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:129754 Archived-At: On Tue, 10 Aug 2010 12:38:14 +0300, Giorgos Keramidas wrote: > On Mon, 09 Aug 2010 19:16:33 -0400, Dan Nicolaescu wrote: >> Giorgos Keramidas writes: >>> 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 > >> What we use now is a shorter version what the autoconf manual >> recommends. Could you ask the autoconf guys about this, and post the >> solution here? That would help fix the same problem for other >> programs, not only for emacs. > > The manual version is indeed bogus. It assumes that if __GNUC__ is > defined, then __builtin_alloca() is always ok. I'll try to contact the > autoconf people. In the meantime the patch seems to have fixed the > alloca() warnigns on FreeBSD. I'll keep it in my personal patch queue: > > http://bitbucket.org/keramida/emacs-bsd-patches/src/tip/patch-alloca > http://bitbucket.org/keramida/emacs-bsd-patches/src/tip/patch-alloca-regen > > So when the autoconf people reply I'll followup with more details. I've sent the following to the Autoconf bug list. If they change the Autoconf manual we can safely commit the modified version to GNU Emacs too. From: Giorgos Keramidas To: bug-autoconf@gnu.org Subject: alloca.h example in the manual Date: Tue, 07 Sep 2010 21:55:32 +0300 Message-ID: <87pqwpo02j.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) Hi all, The Autoconf manual (section 5.5.2, "Particular Function Checks") recommends the following check for source files that use the alloca() function: #ifdef HAVE_ALLOCA_H # include #elif defined __GNUC__ # define alloca __builtin_alloca #elif defined _AIX # define alloca __alloca #elif defined _MSC_VER # include # define alloca _alloca #else # include # ifdef __cplusplus extern "C" # endif void *alloca (size_t); #endif There are systems where this breaks though, because alloca() is available as a function but not in a special 'alloca.h' header file. For example, in FreeBSD, alloca() is defined in 'stdlib.h' and this means that HAVE_ALLOCA_H is undefined. The result of the previous macro bits is that a redundant prototype of alloca() is declared. The modified version shown below declares a prototype of alloca() only when HAVE_ALLOCA is unset/undefined regardless of what HAVE_ALLOCA_H is set to: #ifdef HAVE_ALLOCA_H # include #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 #endif This fixes the alloca() related warnings of at least GNU Emacs on my FreeBSD installations. I've submitted the relevant changes to the GNU Emacs maintainers, but if we can fix the example in the autoconf manual too it would be really nice.