[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
alloca_.h suggested change
From: |
Mark D. Baushke |
Subject: |
alloca_.h suggested change |
Date: |
Mon, 19 Jun 2006 01:37:37 -0700 |
On FreeBSD 6.1, the file /usr/include/stdlib.h has the following
on lines 219 through 233 inclusive:
/*
* The alloca() function can't be implemented in C, and on some
* platforms it can't be implemented at all as a callable function.
* The GNU C compiler provides a built-in alloca() which we can use;
* in all other cases, provide a prototype, mainly to pacify various
* incarnations of lint. On platforms where alloca() is not in libc,
* programs which use it will fail to link when compiled with non-GNU
* compilers.
*/
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#undef alloca /* some GNU bits try to get cute and define this on their own */
#define alloca(sz) __builtin_alloca(sz)
#elif defined(lint)
void *alloca(size_t);
#endif
This leads to warnings line this one being generated:
if gcc -DHAVE_CONFIG_H -I. -I../../lib -I.. -I../intl -Ino/include -g -O2 -MT
mkdirat.o -MD -MP -MF ".deps/mkdirat.Tpo" -c -o mkdirat.o ../../lib/mkdirat.c;
then mv -f ".deps/mkdirat.Tpo" ".deps/mkdirat.Po"; else rm -f ".deps/mkdirat.Tp
o"; exit 1; fi
In file included from ../../lib/openat-priv.h:22,
from ../../lib/mkdirat.c:37:
./alloca.h:38:1: warning: "alloca" redefined
In file included from ../../lib/mkdirat.c:26:
/usr/include/stdlib.h:230:1: warning: this is the location of the previous
definition
The following patch helps to reduce the noise during a compilation.
Thanks,
-- Mark
Index: alloca_.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/alloca_.h,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 alloca_.h
--- alloca_.h 14 May 2005 06:03:57 -0000 1.8
+++ alloca_.h 19 Jun 2006 08:29:51 -0000
@@ -35,7 +35,9 @@
*/
#ifdef __GNUC__
-# define alloca __builtin_alloca
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
#elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
- alloca_.h suggested change,
Mark D. Baushke <=