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/9436cced
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/9436cced
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/9436cced

Branch: refs/heads/cfc-sprintf
Commit: 9436cced6c763b4398ac897613b4bd737ed017f4
Parents: 8ec9f3f
Author: Nick Wellnhofer <[email protected]>
Authored: Wed Dec 26 19:30:45 2012 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Dec 26 19:30:45 2012 +0100

----------------------------------------------------------------------
 clownfish/compiler/common/charmonizer.c |   90 ++++++++++++++++++++++++++
 clownfish/runtime/common/charmonizer.c  |   89 +++++++++++++++++++++++++
 common/charmonizer.c                    |   89 +++++++++++++++++++++++++
 3 files changed, 268 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/9436cced/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c 
b/clownfish/compiler/common/charmonizer.c
index 4e7ba0c..550e6d6 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,76 @@ 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 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(  }                                              );
+    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 found in the MSVCRT.
+     */
+    output = chaz_CC_capture_output(scprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+        }
+        free(output);
+    }
+}
+
+
 #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 +2916,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/9436cced/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c 
b/clownfish/runtime/common/charmonizer.c
index 4de6205..37a0777 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,76 @@ 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 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(  }                                              );
+    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 found in the MSVCRT.
+     */
+    output = chaz_CC_capture_output(scprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+        }
+        free(output);
+    }
+}
+
+
+/***************************************************************************/
+
 #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/9436cced/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index f600dbd..2275855 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,76 @@ 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 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(  }                                              );
+    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 found in the MSVCRT.
+     */
+    output = chaz_CC_capture_output(scprintf_code, &output_len);
+    if (output != NULL) {
+        long result = strtol(output, NULL, 10);
+        if (result == 5) {
+            chaz_ConfWriter_add_def("HAS__SCPRINTF", NULL);
+        }
+        free(output);
+    }
+}
+
+
+/***************************************************************************/
+
 #line 17 "src/Charmonizer/Probe/SymbolVisibility.c"
 /* #include "Charmonizer/Probe/SymbolVisibility.h" */
 /* #include "Charmonizer/Core/Compiler.h" */

Reply via email to