You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/10/26 03:24:50 UTC
[lucy-commits] svn commit: r1027334 -
/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
Author: marvin
Date: Tue Oct 26 01:24:50 2010
New Revision: 1027334
URL: http://svn.apache.org/viewvc?rev=1027334&view=rev
Log:
Add __builtin_alloca as an option in alloca probe.
Modified:
incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=1027334&r1=1027333&r2=1027334&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Tue Oct 26 01:24:50 2010
@@ -39,6 +39,7 @@ Memory_run(void)
chaz_bool_t has_malloc_h = false;
chaz_bool_t need_stdlib_h = false;
chaz_bool_t has_alloca = false;
+ chaz_bool_t has_builtin_alloca = false;
chaz_bool_t has_underscore_alloca = false;
char code_buf[sizeof(alloca_code) + 100];
@@ -52,7 +53,7 @@ Memory_run(void)
ConfWriter_append_conf("#define CHY_HAS_ALLOCA_H\n");
ConfWriter_append_conf("#define chy_alloca alloca\n");
}
- else {
+ if (!has_alloca) {
sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_alloca = true;
@@ -61,9 +62,17 @@ Memory_run(void)
ConfWriter_append_conf("#define chy_alloca alloca\n");
}
}
+ if (!has_alloca) {
+ sprintf(code_buf, alloca_code, "stdio.h", /* stdio.h is filler */
+ "__builtin_alloca");
+ if (CC_test_compile(code_buf, strlen(code_buf))) {
+ has_builtin_alloca = true;
+ ConfWriter_append_conf("#define chy_alloca __builtin_alloca\n");
+ }
+ }
/* Windows. */
- if (!has_alloca) {
+ if (!has_alloca || has_builtin_alloca) {
sprintf(code_buf, alloca_code, "malloc.h", "alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_malloc_h = true;
@@ -72,7 +81,7 @@ Memory_run(void)
ConfWriter_append_conf("#define chy_alloca alloca\n");
}
}
- if (!has_alloca) {
+ if (!has_alloca || has_builtin_alloca) {
sprintf(code_buf, alloca_code, "malloc.h", "_alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_malloc_h = true;
@@ -96,6 +105,9 @@ Memory_run(void)
if (need_stdlib_h) {
ConfWriter_shorten_macro("ALLOCA_IN_STDLIB_H");
}
+ if (!has_alloca && has_builtin_alloca) {
+ ConfWriter_shorten_function("alloca");
+ }
ConfWriter_end_short_names();
ConfWriter_end_module();