Include inttypes.h for PRIx64 macros Define PRIx64 macros if inttypes.h is not present
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/07655e3a Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/07655e3a Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/07655e3a Branch: refs/heads/c99-types Commit: 07655e3a94edc5dd47b4a65d4256040fb5cf88b7 Parents: 9425059 Author: Nick Wellnhofer <[email protected]> Authored: Sun Nov 18 01:05:09 2012 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Nov 18 16:36:40 2012 +0100 ---------------------------------------------------------------------- charmonizer/src/Charmonizer/Probe/Integers.c | 11 ++++++++++- charmonizer/src/Charmonizer/Probe/Integers.h | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/07655e3a/charmonizer/src/Charmonizer/Probe/Integers.c ---------------------------------------------------------------------- diff --git a/charmonizer/src/Charmonizer/Probe/Integers.c b/charmonizer/src/Charmonizer/Probe/Integers.c index 37a6090..27d829c 100644 --- a/charmonizer/src/Charmonizer/Probe/Integers.c +++ b/charmonizer/src/Charmonizer/Probe/Integers.c @@ -270,7 +270,10 @@ chaz_Integers_run(void) { /* Write typedefs, maximums/minimums and literals macros. */ chaz_ConfWriter_add_typedef("int", "bool_t"); - if (has_stdint) { + if (has_inttypes) { + chaz_ConfWriter_add_sys_include("inttypes.h"); + } + else if (has_stdint) { chaz_ConfWriter_add_sys_include("stdint.h"); } else { @@ -382,6 +385,12 @@ chaz_Integers_run(void) { chaz_ConfWriter_add_def("I64P", scratch); sprintf(scratch, "\"%su\"", options[i]); chaz_ConfWriter_add_def("U64P", scratch); + if (!has_inttypes) { + 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; } } http://git-wip-us.apache.org/repos/asf/lucy/blob/07655e3a/charmonizer/src/Charmonizer/Probe/Integers.h ---------------------------------------------------------------------- diff --git a/charmonizer/src/Charmonizer/Probe/Integers.h b/charmonizer/src/Charmonizer/Probe/Integers.h index edc2fa2..708a46f 100644 --- a/charmonizer/src/Charmonizer/Probe/Integers.h +++ b/charmonizer/src/Charmonizer/Probe/Integers.h @@ -76,6 +76,13 @@ * UINT32_C * UINT64_C * + * If inttypes.h is is available, it will be pound-included in the + * configuration header. If it is not, the following macros will be defined if + * possible: + * + * PRId64 + * PRIu64 + * * The following typedefs will be created: * * bool_t
