You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2012/11/18 19:46:19 UTC

[lucy-commits] [12/23] git commit: refs/heads/c99-types - Remove old I64P and U64P macros.

Remove old I64P and U64P macros.


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

Branch: refs/heads/c99-types
Commit: 138e4d532aa3efd6cd786c15efc64839ff0eee33
Parents: 3e9a805
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Nov 18 01:23:02 2012 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Nov 18 16:37:04 2012 +0100

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Probe/Integers.c |  214 ++++++++++-----------
 charmonizer/src/Charmonizer/Probe/Integers.h |    7 -
 2 files changed, 105 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/138e4d53/charmonizer/src/Charmonizer/Probe/Integers.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/Integers.c b/charmonizer/src/Charmonizer/Probe/Integers.c
index 27d829c..570c305 100644
--- a/charmonizer/src/Charmonizer/Probe/Integers.c
+++ b/charmonizer/src/Charmonizer/Probe/Integers.c
@@ -273,128 +273,124 @@ chaz_Integers_run(void) {
     if (has_inttypes) {
         chaz_ConfWriter_add_sys_include("inttypes.h");
     }
-    else if (has_stdint) {
-        chaz_ConfWriter_add_sys_include("stdint.h");
-    }
     else {
-        /* We support only the following subset of stdint.h
-         *   int8_t
-         *   int16_t
-         *   int32_t
-         *   int64_t
-         *   uint8_t
-         *   uint16_t
-         *   uint32_t
-         *   uint64_t
-         *   INT8_MAX
-         *   INT16_MAX
-         *   INT32_MAX
-         *   INT64_MAX
-         *   INT8_MIN
-         *   INT16_MIN
-         *   INT32_MIN
-         *   INT64_MIN
-         *   UINT8_MAX
-         *   UINT16_MAX
-         *   UINT32_MAX
-         *   UINT64_MAX
-         *   SIZE_MAX
-         *   INT32_C
-         *   INT64_C
-         *   UINT32_C
-         *   UINT64_C
-         */
-        if (has_8) {
-            chaz_ConfWriter_add_global_typedef("signed char", "int8_t");
-            chaz_ConfWriter_add_global_typedef("unsigned char", "uint8_t");
-            chaz_ConfWriter_add_global_def("INT8_MAX", "127");
-            chaz_ConfWriter_add_global_def("INT8_MIN", "-128");
-            chaz_ConfWriter_add_global_def("UINT8_MAX", "255");
-        }
-        if (has_16) {
-            chaz_ConfWriter_add_global_typedef("signed short", "int16_t");
-            chaz_ConfWriter_add_global_typedef("unsigned short", "uint16_t");
-            chaz_ConfWriter_add_global_def("INT16_MAX", "32767");
-            chaz_ConfWriter_add_global_def("INT16_MIN", "-32768");
-            chaz_ConfWriter_add_global_def("UINT16_MAX", "65535");
+        if (has_stdint) {
+            chaz_ConfWriter_add_sys_include("stdint.h");
         }
-        if (has_32) {
-            chaz_ConfWriter_add_global_typedef(i32_t_type, "int32_t");
-            sprintf(scratch, "unsigned %s", i32_t_type);
-            chaz_ConfWriter_add_global_typedef(scratch, "uint32_t");
-            chaz_ConfWriter_add_global_def("INT32_MAX", "2147483647");
-            chaz_ConfWriter_add_global_def("INT32_MIN", "(-INT32_MAX-1)");
-            chaz_ConfWriter_add_global_def("UINT32_MAX", "4294967295U");
-            if (strcmp(i32_t_postfix, "") == 0) {
-                chaz_ConfWriter_add_global_def("INT32_C(n)", "n");
+        else {
+            /* We support only the following subset of stdint.h
+             *   int8_t
+             *   int16_t
+             *   int32_t
+             *   int64_t
+             *   uint8_t
+             *   uint16_t
+             *   uint32_t
+             *   uint64_t
+             *   INT8_MAX
+             *   INT16_MAX
+             *   INT32_MAX
+             *   INT64_MAX
+             *   INT8_MIN
+             *   INT16_MIN
+             *   INT32_MIN
+             *   INT64_MIN
+             *   UINT8_MAX
+             *   UINT16_MAX
+             *   UINT32_MAX
+             *   UINT64_MAX
+             *   SIZE_MAX
+             *   INT32_C
+             *   INT64_C
+             *   UINT32_C
+             *   UINT64_C
+             */
+            if (has_8) {
+                chaz_ConfWriter_add_global_typedef("signed char", "int8_t");
+                chaz_ConfWriter_add_global_typedef("unsigned char", "uint8_t");
+                chaz_ConfWriter_add_global_def("INT8_MAX", "127");
+                chaz_ConfWriter_add_global_def("INT8_MIN", "-128");
+                chaz_ConfWriter_add_global_def("UINT8_MAX", "255");
             }
-            else {
-                sprintf(scratch, "n##%s", i32_t_postfix);
-                chaz_ConfWriter_add_global_def("INT32_C(n)", scratch);
+            if (has_16) {
+                chaz_ConfWriter_add_global_typedef("signed short", "int16_t");
+                chaz_ConfWriter_add_global_typedef("unsigned short",
+                                                   "uint16_t");
+                chaz_ConfWriter_add_global_def("INT16_MAX", "32767");
+                chaz_ConfWriter_add_global_def("INT16_MIN", "-32768");
+                chaz_ConfWriter_add_global_def("UINT16_MAX", "65535");
             }
-            sprintf(scratch, "n##%s", u32_t_postfix);
-            chaz_ConfWriter_add_global_def("UINT32_C(n)", scratch);
-        }
-        if (has_64) {
-            chaz_ConfWriter_add_global_typedef(i64_t_type, "int64_t");
-            sprintf(scratch, "unsigned %s", i64_t_type);
-            chaz_ConfWriter_add_global_typedef(scratch, "uint64_t");
-            sprintf(scratch, "9223372036854775807%s", i64_t_postfix);
-            chaz_ConfWriter_add_global_def("INT64_MAX", scratch);
-            chaz_ConfWriter_add_global_def("INT64_MIN", "(-INT64_MAX-1)");
-            sprintf(scratch, "18446744073709551615%s", u64_t_postfix);
-            chaz_ConfWriter_add_global_def("UINT64_MAX", scratch);
-            sprintf(scratch, "n##%s", i64_t_postfix);
-            chaz_ConfWriter_add_global_def("INT64_C(n)", scratch);
-            sprintf(scratch, "n##%s", u64_t_postfix);
-            chaz_ConfWriter_add_global_def("UINT64_C(n)", scratch);
+            if (has_32) {
+                chaz_ConfWriter_add_global_typedef(i32_t_type, "int32_t");
+                sprintf(scratch, "unsigned %s", i32_t_type);
+                chaz_ConfWriter_add_global_typedef(scratch, "uint32_t");
+                chaz_ConfWriter_add_global_def("INT32_MAX", "2147483647");
+                chaz_ConfWriter_add_global_def("INT32_MIN", "(-INT32_MAX-1)");
+                chaz_ConfWriter_add_global_def("UINT32_MAX", "4294967295U");
+                if (strcmp(i32_t_postfix, "") == 0) {
+                    chaz_ConfWriter_add_global_def("INT32_C(n)", "n");
+                }
+                else {
+                    sprintf(scratch, "n##%s", i32_t_postfix);
+                    chaz_ConfWriter_add_global_def("INT32_C(n)", scratch);
+                }
+                sprintf(scratch, "n##%s", u32_t_postfix);
+                chaz_ConfWriter_add_global_def("UINT32_C(n)", scratch);
+            }
+            if (has_64) {
+                chaz_ConfWriter_add_global_typedef(i64_t_type, "int64_t");
+                sprintf(scratch, "unsigned %s", i64_t_type);
+                chaz_ConfWriter_add_global_typedef(scratch, "uint64_t");
+                sprintf(scratch, "9223372036854775807%s", i64_t_postfix);
+                chaz_ConfWriter_add_global_def("INT64_MAX", scratch);
+                chaz_ConfWriter_add_global_def("INT64_MIN", "(-INT64_MAX-1)");
+                sprintf(scratch, "18446744073709551615%s", u64_t_postfix);
+                chaz_ConfWriter_add_global_def("UINT64_MAX", scratch);
+                sprintf(scratch, "n##%s", i64_t_postfix);
+                chaz_ConfWriter_add_global_def("INT64_C(n)", scratch);
+                sprintf(scratch, "n##%s", u64_t_postfix);
+                chaz_ConfWriter_add_global_def("UINT64_C(n)", scratch);
+            }
+            chaz_ConfWriter_add_global_def("SIZE_MAX", "((size_t)-1)");
         }
-        chaz_ConfWriter_add_global_def("SIZE_MAX", "((size_t)-1)");
-    }
-
-    /* Create the I64P and U64P printf macros. */
-    if (has_64) {
-        int i;
-        const char *options[] = {
-            "ll",
-            "l",
-            "L",
-            "q",  /* Some *BSDs */
-            "I64", /* Microsoft */
-            NULL,
-        };
-
-        /* Buffer to hold the code, and its start and end. */
-        static const char format_64_code[] =
-            CHAZ_QUOTE(  #include "_charm.h"                           )
-            CHAZ_QUOTE(  int main() {                                  )
-            CHAZ_QUOTE(      Charm_Setup;                              )
-            CHAZ_QUOTE(      printf("%%%su", 18446744073709551615%s);  )
-            CHAZ_QUOTE(      return 0;                                 )
-            CHAZ_QUOTE( }                                              );
 
-        for (i = 0; options[i] != NULL; i++) {
-            /* Try to print 2**64-1, and see if we get it back intact. */
-            sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
-            output = chaz_CC_capture_output(code_buf, &output_len);
-
-            if (output_len != 0
-                && strcmp(output, "18446744073709551615") == 0
-               ) {
-                sprintf(scratch, "\"%sd\"", options[i]);
-                chaz_ConfWriter_add_def("I64P", scratch);
-                sprintf(scratch, "\"%su\"", options[i]);
-                chaz_ConfWriter_add_def("U64P", scratch);
-                if (!has_inttypes) {
+        /* Create the PRId64 and PRIu64 printf macros. */
+        if (has_64) {
+            int i;
+            const char *options[] = {
+                "ll",
+                "l",
+                "L",
+                "q",  /* Some *BSDs */
+                "I64", /* Microsoft */
+                NULL,
+            };
+
+            /* Buffer to hold the code, and its start and end. */
+            static const char format_64_code[] =
+                CHAZ_QUOTE(  #include "_charm.h"                           )
+                CHAZ_QUOTE(  int main() {                                  )
+                CHAZ_QUOTE(      Charm_Setup;                              )
+                CHAZ_QUOTE(      printf("%%%su", 18446744073709551615%s);  )
+                CHAZ_QUOTE(      return 0;                                 )
+                CHAZ_QUOTE( }                                              );
+
+            for (i = 0; options[i] != NULL; i++) {
+                /* Try to print 2**64-1, and see if we get it back intact. */
+                sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
+                output = chaz_CC_capture_output(code_buf, &output_len);
+
+                if (output_len != 0
+                    && strcmp(output, "18446744073709551615") == 0
+                   ) {
                     sprintf(scratch, "\"%sd\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRId64", scratch);
                     sprintf(scratch, "\"%su\"", options[i]);
                     chaz_ConfWriter_add_global_def("PRIu64", scratch);
+                    break;
                 }
-                break;
             }
         }
-
     }
 
     /* Create macro for promoting pointers to integers. */

http://git-wip-us.apache.org/repos/asf/lucy/blob/138e4d53/charmonizer/src/Charmonizer/Probe/Integers.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe/Integers.h b/charmonizer/src/Charmonizer/Probe/Integers.h
index 708a46f..cb15da1 100644
--- a/charmonizer/src/Charmonizer/Probe/Integers.h
+++ b/charmonizer/src/Charmonizer/Probe/Integers.h
@@ -99,13 +99,6 @@
  *
  * PTR_TO_I64(ptr)
  *
- * If 64-bit integers are available, these macros will expand to the printf
- * conversion specification for signed and unsigned versions (most commonly
- * "lld" and "llu").
- *
- * I64P
- * U64P
- *
  * These symbols will be defined if they are not already:
  *
  * true