all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6170: 24.0.50; Compiling on solaris2.10 with gcc doesn't define alloca
@ 2010-05-11 10:57 Lawrence Mitchell
  2010-05-12 18:29 ` Dan Nicolaescu
  0 siblings, 1 reply; 4+ messages in thread
From: Lawrence Mitchell @ 2010-05-11 10:57 UTC (permalink / raw)
  To: 6170


On this system, <stdlib.h> is provided by Sun and therefore
doesn't define alloca, unlike on a typical GNU/linux system where
<stdlib.h> contains the following:

| #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
| # include <alloca.h>
| #endif /* Use GNU, BSD, or misc.  */

When compiling emacs with gcc, alloca is therefore undefined.
The culprit is this snippet in configure.in:

| #ifndef __GNUC__
| # ifdef HAVE_ALLOCA_H
| #  include <alloca.h>
| # else /* AIX files deal with #pragma.  */
| #  ifndef alloca /* predefined by HP cc +Olibcalls */
| char *alloca ();
| #  endif
| # endif /* HAVE_ALLOCA_H */
| #endif /* __GNUC__ */

On this system, configure correctly defines both HAVE_ALLOCA_H
and HAVE_ALLOCA, but since the inclusion is guarded by __GNUC__
not being defined, we never include <alloca.h>.

I think the correct fix is to unconditionally define alloca if
__GNUC__ is detected, see patch below.  Note that this is closer
to how autoconf checks for the presence of the alloca function.

Possible changelog entry:

2010-05-11  Lawrence Mitchell  <wence@gmx.li>

	* configure.in: Unconditionally define alloca if __GNUC__ is
	detected.

diff --git a/configure.in b/configure.in
index 8a7d9be..98b6abb 100644
--- a/configure.in
+++ b/configure.in
@@ -3360,6 +3360,9 @@ extern char *getenv ();
 char *alloca ();
 #  endif
 # endif /* HAVE_ALLOCA_H */
+#else
+# undef alloca
+# define alloca __builtin_alloca
 #endif /* __GNUC__ */
 #ifndef HAVE_SIZE_T
 typedef unsigned size_t;





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-02  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 10:57 bug#6170: 24.0.50; Compiling on solaris2.10 with gcc doesn't define alloca Lawrence Mitchell
2010-05-12 18:29 ` Dan Nicolaescu
2010-05-31 16:42   ` Lawrence Mitchell
2010-06-02  9:24     ` Dan Nicolaescu

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.