all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Giorgos Keramidas <keramida@ceid.upatras.gr>
To: Dan Nicolaescu <dann@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: alloca() warnings on freebsd
Date: Tue, 07 Sep 2010 22:01:16 +0300	[thread overview]
Message-ID: <87lj7dnzsz.fsf@kobe.laptop> (raw)
In-Reply-To: <87lj8else1.fsf@kobe.laptop> (Giorgos Keramidas's message of "Tue, 10 Aug 2010 12:38:14 +0300")

On Tue, 10 Aug 2010 12:38:14 +0300, Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
> On Mon, 09 Aug 2010 19:16:33 -0400, Dan Nicolaescu <dann@gnu.org> wrote:
>> Giorgos Keramidas <keramida@ceid.upatras.gr> 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 <alloca.h>
>>>     #elif defined __GNUC__
>>>     # define alloca __builtin_alloca
>>>     #elif defined _AIX
>>>     # define alloca __alloca
>>>     #else
>>>     # include <stddef.h>
>>>     # 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 <gkeramidas@gmail.com>
    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 <alloca.h>
        #elif defined __GNUC__
        # define alloca __builtin_alloca
        #elif defined _AIX
        # define alloca __alloca
        #elif defined _MSC_VER
        # include <malloc.h>
        # define alloca _alloca
        #else
        # include <stddef.h>
        # 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 <alloca.h>
        #elif !defined(HAVE_ALLOCA)
        # if defined __GNUC__
        #  define alloca __builtin_alloca
        # elif defined _AIX
        #  define alloca __alloca
        # else
        #  include <stddef.h>
        #  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.




      reply	other threads:[~2010-09-07 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 22:09 alloca() warnings on freebsd Giorgos Keramidas
2010-08-09 23:16 ` Dan Nicolaescu
2010-08-10  9:38   ` Giorgos Keramidas
2010-09-07 19:01     ` Giorgos Keramidas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lj7dnzsz.fsf@kobe.laptop \
    --to=keramida@ceid.upatras.gr \
    --cc=dann@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.