lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r930415 - in /lucene/lucy/trunk/charmonizer: charmonize.c src/Charmonizer/Probe/Memory.c src/Charmonizer/Probe/Memory.h
Date Fri, 02 Apr 2010 22:15:22 GMT
Author: marvin
Date: Fri Apr  2 22:15:22 2010
New Revision: 930415

URL: http://svn.apache.org/viewvc?rev=930415&view=rev
Log:
Have Charmonizer handle the situation properly when alloca() can only be found
in stdlib.h.

Modified:
    lucene/lucy/trunk/charmonizer/charmonize.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
    lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h

Modified: lucene/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/charmonize.c?rev=930415&r1=930414&r2=930415&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/charmonize.c (original)
+++ lucene/lucy/trunk/charmonizer/charmonize.c Fri Apr  2 22:15:22 2010
@@ -57,6 +57,8 @@ int main(int argc, char **argv) 
         "  #include <alloca.h>\n"
         "#elif defined(CHY_HAS_MALLOC_H)\n"
         "  #include <malloc.h>\n"
+        "#elif defined(CHY_ALLOCA_IN_STDLIB_H)\n"
+        "  #include <stdlib.h>\n"
         "#endif\n\n"
     );
 

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=930415&r1=930414&r2=930415&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Fri Apr  2 22:15:22 2010
@@ -19,10 +19,11 @@ static char alloca_code[] = 
 void
 Memory_run(void) 
 {
-    chaz_bool_t  has_alloca_h = false;
-    chaz_bool_t  has_malloc_h = false;
-    chaz_bool_t  has_alloca   = false;
-    chaz_bool_t  has_underscore_alloca = false;
+    chaz_bool_t has_alloca_h  = false;
+    chaz_bool_t has_malloc_h  = false;
+    chaz_bool_t need_stdlib_h = false;
+    chaz_bool_t has_alloca    = false;
+    chaz_bool_t has_underscore_alloca = false;
     char code_buf[sizeof(alloca_code) + 100];
 
     ConfWriter_start_module("Memory");
@@ -35,6 +36,15 @@ Memory_run(void) 
         ConfWriter_append_conf("#define CHY_HAS_ALLOCA_H\n");
         ConfWriter_append_conf("#define chy_alloca alloca\n");
     }
+    else {
+        sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
+        if (CC_test_compile(code_buf, strlen(code_buf))) {
+            has_alloca    = true;
+            need_stdlib_h = true;
+            ConfWriter_append_conf("#define CHY_ALLOCA_IN_STDLIB_H\n");
+            ConfWriter_append_conf("#define chy_alloca alloca\n");
+        }
+    }
 
     /* Windows. */
     if (!has_alloca) {
@@ -67,6 +77,9 @@ Memory_run(void) 
             ConfWriter_shorten_function("alloca");
         }
     }
+    if (need_stdlib_h) {
+        ConfWriter_shorten_macro("ALLOCA_IN_STDLIB_H");
+    }
     ConfWriter_end_short_names();
 
     ConfWriter_end_module();

Modified: lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h?rev=930415&r1=930414&r2=930415&view=diff
==============================================================================
--- lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h (original)
+++ lucene/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h Fri Apr  2 22:15:22 2010
@@ -18,6 +18,10 @@ extern "C" {
  * 
  * HAS_ALLOCA_H            <alloca.h> 
  * HAS_MALLOC_H            <malloc.h>
+ *
+ * Defined if alloca() is available via stdlib.h:
+ *
+ * ALLOCA_IN_STDLIB_H
  */
 void chaz_Memory_run(void);
 



Mime
View raw message