Don't run 64-bit format string probe under C99 Feature tests for format strings can't be compile-only but require execution of a test program which breaks when cross-compiling. But if C99's inttypes.h is available, there's no need for a probe at all.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/bf016446 Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/bf016446 Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/bf016446 Branch: refs/heads/master Commit: bf0164464849fa7872d0805fba617e78299dc6d3 Parents: 7740918 Author: Nick Wellnhofer <[email protected]> Authored: Fri Feb 3 17:56:07 2017 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sat Feb 4 18:10:18 2017 +0100 ---------------------------------------------------------------------- src/Charmonizer/Probe/Integers.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/bf016446/src/Charmonizer/Probe/Integers.c ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Probe/Integers.c b/src/Charmonizer/Probe/Integers.c index 6ae12a0..885dd59 100644 --- a/src/Charmonizer/Probe/Integers.c +++ b/src/Charmonizer/Probe/Integers.c @@ -174,7 +174,7 @@ chaz_Integers_run(void) { } /* Probe for 64-bit printf format string modifier. */ - if (has_64) { + if (!has_inttypes && has_64) { int i; const char *options[] = { "ll", @@ -503,7 +503,7 @@ chaz_Integers_run(void) { chaz_ConfWriter_add_sys_include("inttypes.h"); } - { + if (!has_inttypes || !has_intptr_t) { /* We support only the following subset of inttypes.h * PRId32 * PRIi32 @@ -540,10 +540,9 @@ chaz_Integers_run(void) { int c = ptr[0]; if (has_32) { - sprintf(scratch, "\"%s%c\"", printf_modifier_32, c); - + macro_name_32[3] = c; if (!has_inttypes) { - macro_name_32[3] = c; + sprintf(scratch, "\"%s%c\"", printf_modifier_32, c); chaz_ConfWriter_add_global_def(macro_name_32, scratch); if (!has_64) { macro_name_max[3] = c; @@ -553,21 +552,22 @@ chaz_Integers_run(void) { } if (!has_intptr_t && sizeof_ptr == 4) { macro_name_ptr[3] = c; - chaz_ConfWriter_add_global_def(macro_name_ptr, scratch); + chaz_ConfWriter_add_global_def(macro_name_ptr, + macro_name_32); } } if (has_64) { - sprintf(scratch, "\"%s%c\"", printf_modifier_64, c); - + macro_name_64[3] = c; if (!has_inttypes) { - macro_name_64[3] = c; + sprintf(scratch, "\"%s%c\"", printf_modifier_64, c); chaz_ConfWriter_add_global_def(macro_name_64, scratch); macro_name_max[3] = c; chaz_ConfWriter_add_global_def(macro_name_max, scratch); } if (!has_intptr_t && sizeof_ptr == 8) { macro_name_ptr[3] = c; - chaz_ConfWriter_add_global_def(macro_name_ptr, scratch); + chaz_ConfWriter_add_global_def(macro_name_ptr, + macro_name_64); } } }
