[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recommended alloca declaration breaks on alloca.c
From: |
Paul Eggert |
Subject: |
Re: Recommended alloca declaration breaks on alloca.c |
Date: |
Sun, 10 Apr 2005 15:21:14 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Hrvoje Niksic <address@hidden> writes:
> I fixed this problem by changing the declaration from "char
> *alloca();" to "void *alloca();". Is there a better fix, or should
> the manual be updated for alloca to return void *?
Thanks for reporting this. The manual should be updated, for this and
other things. I installed this patch:
2005-04-10 Paul Eggert <address@hidden>
* doc/autoconf.texi (Particular Functions): Use gnulib's current
pattern for alloca snippet.
Index: autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.885
retrieving revision 1.886
diff -p -u -r1.885 -r1.886
--- autoconf.texi 1 Apr 2005 08:55:58 -0000 1.885
+++ autoconf.texi 10 Apr 2005 22:19:26 -0000 1.886
@@ -3986,27 +3986,25 @@ still want to use their @code{alloca}, u
@file{alloca.o} from them instead of compiling @file{alloca.c}.
Source files that use @code{alloca} should start with a piece of code
-like the following, to declare it properly. In some versions of @acronym{AIX},
-the declaration of @code{alloca} must precede everything else except for
-comments and preprocessor directives. The @code{#pragma} directive is
-indented so that address@hidden C compilers will ignore it, rather than
-choke on it.
+like the following, to declare it properly.
@example
@group
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
+#if 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
@end group
@end example
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Recommended alloca declaration breaks on alloca.c,
Paul Eggert <=