[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
alloca() warnings on freebsd
From: |
Giorgos Keramidas |
Subject: |
alloca() warnings on freebsd |
Date: |
Tue, 10 Aug 2010 01:09:44 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) |
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
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 <address@hidden>
+
+ * 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 <address@hidden>
* 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 <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
+#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
-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 <address@hidden>
+
+ * 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 <address@hidden>
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 <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#else
-# include <stddef.h>
-# ifdef __cplusplus
+#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
-void *alloca (size_t);
#endif
#ifndef HAVE_SIZE_T
%%%
- alloca() warnings on freebsd,
Giorgos Keramidas <=