Regenerate charmonizer.c

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e80ba0dd
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e80ba0dd
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e80ba0dd

Branch: refs/heads/master
Commit: e80ba0dd8bf0d18a474922dd9f4e7a648badcb51
Parents: af81001
Author: Nick Wellnhofer <[email protected]>
Authored: Wed Dec 26 19:30:45 2012 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Fri Dec 28 22:23:10 2012 +0100

----------------------------------------------------------------------
 clownfish/compiler/common/charmonizer.c |   97 ++++++++++++++++++++++++++
 clownfish/runtime/common/charmonizer.c  |   96 +++++++++++++++++++++++++
 common/charmonizer.c                    |   96 +++++++++++++++++++++++++
 3 files changed, 289 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/e80ba0dd/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c 
b/clownfish/compiler/common/charmonizer.c
index 4e7ba0c..84d8d71 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -560,6 +560,25 @@ void chaz_Integers_run(void);
 
 /***************************************************************************/
 
+#line 21 "src/Charmonizer/Probe/Strings.h"
+/* Charmonizer/Probe/Strings.h
+ */
+
+#ifndef H_CHAZ_STRINGS
+#define H_CHAZ_STRINGS
+
+/* The Strings module attempts to detect whether snprintf works as specified
+ * by the C99 standard. It also looks for system-specific functions which can
+ * be used to emulate snprintf.
+ */
+void chaz_Strings_run(void);
+
+#endif /* H_CHAZ_STRINGS */
+
+
+
+/***************************************************************************/
+
 #line 17 "src/Charmonizer/Core/Compiler.c"
 #include <string.h>
 #include <stdlib.h>
@@ -2739,6 +2758,83 @@ chaz_Integers_machine_is_big_endian(void) {
 
 
 
+/***************************************************************************/
+
+#line 17 "src/Charmonizer/Probe/Strings.c"
+/* #include "Charmonizer/Core/Compiler.h" */
+/* #include "Charmonizer/Core/ConfWriter.h" */
+/* #include "Charmonizer/Probe/Strings.h" */
+
+/* Check for C99-compatible snprintf and possible replacements.
+ */
+static void
+chaz_Strings_probe_c99_snprintf(void);
+
+void
+chaz_Strings_run(void) {
+    chaz_ConfWriter_start_module("Strings");
+
+    /* Check for C99 snprintf. */
+    chaz_Strings_probe_c99_snprintf();
+
+    chaz_ConfWriter_end_module();
+}
+
+static void
+chaz_Strings_probe_c99_snprintf(void) {
+    static const char snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[4];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = snprintf(buf, 4, "%s", "12345");  )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__scprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _scprintf("%s", "12345");         )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[6];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _snprintf(buf, 6, "%s", "12345"); )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    char   *output = NULL;
+    size_t  output_len;
+
+    /* If the buffer passed to snprintf is too small, verify that snprintf
+     * returns the length of the untruncated string which would have been
+     * written to a large enough buffer.
+     */
+    output = chaz_CC_capture_output(snprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS_C99_SNPRINTF", NULL);
+        }
+        free(output);
+    }
+
+    /* Test for _scprintf and _snprintf found in the MSVCRT.
+     */
+    if (chaz_CC_test_compile(detect__scprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+    }
+    if (chaz_CC_test_compile(detect__snprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SNPRINTF", NULL);
+    }
+}
+
+
 #line 1 "clownfish/compiler/common/charmonizer.main"
 /* Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -2827,6 +2923,7 @@ int main(int argc, char **argv) {
 
     /* Run probe modules. */
     chaz_Integers_run();
+    chaz_Strings_run();
 
     /* Clean up. */
     chaz_Probe_clean_up();

http://git-wip-us.apache.org/repos/asf/lucy/blob/e80ba0dd/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c 
b/clownfish/runtime/common/charmonizer.c
index 4de6205..9eb7d19 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -895,6 +895,25 @@ void chaz_Memory_run(void);
 
 /***************************************************************************/
 
+#line 21 "src/Charmonizer/Probe/Strings.h"
+/* Charmonizer/Probe/Strings.h
+ */
+
+#ifndef H_CHAZ_STRINGS
+#define H_CHAZ_STRINGS
+
+/* The Strings module attempts to detect whether snprintf works as specified
+ * by the C99 standard. It also looks for system-specific functions which can
+ * be used to emulate snprintf.
+ */
+void chaz_Strings_run(void);
+
+#endif /* H_CHAZ_STRINGS */
+
+
+
+/***************************************************************************/
+
 #line 21 "src/Charmonizer/Probe/SymbolVisibility.h"
 /* Charmonizer/Probe/SymbolVisibility.h
  */
@@ -4263,6 +4282,83 @@ chaz_Memory_probe_alloca(void) {
 
 /***************************************************************************/
 
+#line 17 "src/Charmonizer/Probe/Strings.c"
+/* #include "Charmonizer/Core/Compiler.h" */
+/* #include "Charmonizer/Core/ConfWriter.h" */
+/* #include "Charmonizer/Probe/Strings.h" */
+
+/* Check for C99-compatible snprintf and possible replacements.
+ */
+static void
+chaz_Strings_probe_c99_snprintf(void);
+
+void
+chaz_Strings_run(void) {
+    chaz_ConfWriter_start_module("Strings");
+
+    /* Check for C99 snprintf. */
+    chaz_Strings_probe_c99_snprintf();
+
+    chaz_ConfWriter_end_module();
+}
+
+static void
+chaz_Strings_probe_c99_snprintf(void) {
+    static const char snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[4];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = snprintf(buf, 4, "%s", "12345");  )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__scprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _scprintf("%s", "12345");         )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[6];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _snprintf(buf, 6, "%s", "12345"); )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    char   *output = NULL;
+    size_t  output_len;
+
+    /* If the buffer passed to snprintf is too small, verify that snprintf
+     * returns the length of the untruncated string which would have been
+     * written to a large enough buffer.
+     */
+    output = chaz_CC_capture_output(snprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS_C99_SNPRINTF", NULL);
+        }
+        free(output);
+    }
+
+    /* Test for _scprintf and _snprintf found in the MSVCRT.
+     */
+    if (chaz_CC_test_compile(detect__scprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+    }
+    if (chaz_CC_test_compile(detect__snprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SNPRINTF", NULL);
+    }
+}
+
+
+/***************************************************************************/
+
 #line 17 "src/Charmonizer/Probe/SymbolVisibility.c"
 /* #include "Charmonizer/Probe/SymbolVisibility.h" */
 /* #include "Charmonizer/Core/Compiler.h" */

http://git-wip-us.apache.org/repos/asf/lucy/blob/e80ba0dd/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index f600dbd..8ed80ae 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -895,6 +895,25 @@ void chaz_Memory_run(void);
 
 /***************************************************************************/
 
+#line 21 "src/Charmonizer/Probe/Strings.h"
+/* Charmonizer/Probe/Strings.h
+ */
+
+#ifndef H_CHAZ_STRINGS
+#define H_CHAZ_STRINGS
+
+/* The Strings module attempts to detect whether snprintf works as specified
+ * by the C99 standard. It also looks for system-specific functions which can
+ * be used to emulate snprintf.
+ */
+void chaz_Strings_run(void);
+
+#endif /* H_CHAZ_STRINGS */
+
+
+
+/***************************************************************************/
+
 #line 21 "src/Charmonizer/Probe/SymbolVisibility.h"
 /* Charmonizer/Probe/SymbolVisibility.h
  */
@@ -4263,6 +4282,83 @@ chaz_Memory_probe_alloca(void) {
 
 /***************************************************************************/
 
+#line 17 "src/Charmonizer/Probe/Strings.c"
+/* #include "Charmonizer/Core/Compiler.h" */
+/* #include "Charmonizer/Core/ConfWriter.h" */
+/* #include "Charmonizer/Probe/Strings.h" */
+
+/* Check for C99-compatible snprintf and possible replacements.
+ */
+static void
+chaz_Strings_probe_c99_snprintf(void);
+
+void
+chaz_Strings_run(void) {
+    chaz_ConfWriter_start_module("Strings");
+
+    /* Check for C99 snprintf. */
+    chaz_Strings_probe_c99_snprintf();
+
+    chaz_ConfWriter_end_module();
+}
+
+static void
+chaz_Strings_probe_c99_snprintf(void) {
+    static const char snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[4];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = snprintf(buf, 4, "%s", "12345");  )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__scprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _scprintf("%s", "12345");         )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    static const char detect__snprintf_code[] =
+        CHAZ_QUOTE(  #include <stdio.h>                             )
+        CHAZ_QUOTE(  int main() {                                   )
+        CHAZ_QUOTE(      char buf[6];                               )
+        CHAZ_QUOTE(      int  result;                               )
+        CHAZ_QUOTE(      result = _snprintf(buf, 6, "%s", "12345"); )
+        CHAZ_QUOTE(      printf("%d", result);                      )
+        CHAZ_QUOTE(      return 0;                                  )
+        CHAZ_QUOTE(  }                                              );
+    char   *output = NULL;
+    size_t  output_len;
+
+    /* If the buffer passed to snprintf is too small, verify that snprintf
+     * returns the length of the untruncated string which would have been
+     * written to a large enough buffer.
+     */
+    output = chaz_CC_capture_output(snprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS_C99_SNPRINTF", NULL);
+        }
+        free(output);
+    }
+
+    /* Test for _scprintf and _snprintf found in the MSVCRT.
+     */
+    if (chaz_CC_test_compile(detect__scprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+    }
+    if (chaz_CC_test_compile(detect__snprintf_code)) {
+        chaz_ConfWriter_add_def("HAS__SNPRINTF", NULL);
+    }
+}
+
+
+/***************************************************************************/
+
 #line 17 "src/Charmonizer/Probe/SymbolVisibility.c"
 /* #include "Charmonizer/Probe/SymbolVisibility.h" */
 /* #include "Charmonizer/Core/Compiler.h" */

Reply via email to