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 2017/02/04 17:37:26 UTC
[7/9] lucy-charmonizer git commit: Move format string code block
Move format string code block
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/7576ef3b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/7576ef3b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/7576ef3b
Branch: refs/heads/master
Commit: 7576ef3b71f47c9fa3566b4ed77c85bf2c8b96ef
Parents: bf01644
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Feb 3 18:02:47 2017 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Feb 4 18:10:18 2017 +0100
----------------------------------------------------------------------
src/Charmonizer/Probe/Integers.c | 82 +++++++++++++++++------------------
1 file changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/7576ef3b/src/Charmonizer/Probe/Integers.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Probe/Integers.c b/src/Charmonizer/Probe/Integers.c
index 885dd59..ab2862d 100644
--- a/src/Charmonizer/Probe/Integers.c
+++ b/src/Charmonizer/Probe/Integers.c
@@ -173,47 +173,6 @@ chaz_Integers_run(void) {
}
}
- /* Probe for 64-bit printf format string modifier. */
- if (!has_inttypes && 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 <stdio.h> )
- CHAZ_QUOTE( int main() { )
- 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. */
- int success;
- sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
- output = chaz_CC_capture_output(code_buf, &output_len);
- success = output != NULL
- && strcmp(output, "18446744073709551615") == 0;
- free(output);
-
- if (success) {
- break;
- }
- }
-
- if (options[i] == NULL) {
- chaz_Util_die("64-bit types, but no printf modifier found");
- }
-
- strcpy(printf_modifier_64, options[i]);
- }
-
/* Write out some conditional defines. */
if (has_inttypes) {
chaz_ConfWriter_add_def("HAS_INTTYPES_H", NULL);
@@ -503,6 +462,47 @@ chaz_Integers_run(void) {
chaz_ConfWriter_add_sys_include("inttypes.h");
}
+ /* Probe for 64-bit printf format string modifier. */
+ if (!has_inttypes && 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 <stdio.h> )
+ CHAZ_QUOTE( int main() { )
+ 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. */
+ int success;
+ sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
+ output = chaz_CC_capture_output(code_buf, &output_len);
+ success = output != NULL
+ && strcmp(output, "18446744073709551615") == 0;
+ free(output);
+
+ if (success) {
+ break;
+ }
+ }
+
+ if (options[i] == NULL) {
+ chaz_Util_die("64-bit types, but no printf modifier found");
+ }
+
+ strcpy(printf_modifier_64, options[i]);
+ }
+
if (!has_inttypes || !has_intptr_t) {
/* We support only the following subset of inttypes.h
* PRId32