summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2013-11-13 16:40:28 -0500
committerAnthony Green <green@moxielogic.com>2013-11-13 16:40:28 -0500
commit8af42f9944f7ed72c81ae360aac6a84dc11f89dc (patch)
tree6c06ed636f5041202eefd739647fd65c24811c83 /include
parent2f5b7ce545473a7f6e41193edc29407cbebe82d5 (diff)
downloadlibffi-8af42f9944f7ed72c81ae360aac6a84dc11f89dc.tar.gz
Respect HAVE_ALLOCA_H
Diffstat (limited to 'include')
-rw-r--r--include/ffi_common.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/ffi_common.h b/include/ffi_common.h
index 650ca69..37f5a9e 100644
--- a/include/ffi_common.h
+++ b/include/ffi_common.h
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- ffi_common.h - Copyright (C) 2011, 2012 Anthony Green
+ ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green
Copyright (C) 2007 Free Software Foundation, Inc
Copyright (c) 1996 Red Hat, Inc.
@@ -19,10 +19,14 @@ extern "C" {
/* Do not move this. Some versions of AIX are very picky about where
this is positioned. */
#ifdef __GNUC__
-/* mingw64 defines this already in malloc.h. */
-#ifndef alloca
-# define alloca __builtin_alloca
-#endif
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+ /* mingw64 defines this already in malloc.h. */
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+# endif
# define MAYBE_UNUSED __attribute__((__unused__))
#else
# define MAYBE_UNUSED
@@ -30,17 +34,17 @@ extern "C" {
# include <alloca.h>
# else
# ifdef _AIX
- #pragma alloca
+# pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
# ifdef _MSC_VER
# define alloca _alloca
# else
char *alloca ();
-# endif
# endif
# endif
# endif
+# endif
#endif
/* Check for the existence of memcpy. */