From 190aefcf89de330b78fd8991bade63377dc5c189 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 14 Jan 2008 09:53:20 -0800 Subject: [PATCH] Use inttypes.h to get uint64_t print format string Code generators should not include _pli_types.h to get standard int types and strings. Use the inttypes.h header file instead. --- tgt-vvp/configure.in | 2 +- tgt-vvp/eval_bool.c | 12 ++++++++++-- tgt-vvp/vvp_config.h.in | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tgt-vvp/configure.in b/tgt-vvp/configure.in index 62e06d9f1..eef3ee18f 100644 --- a/tgt-vvp/configure.in +++ b/tgt-vvp/configure.in @@ -13,7 +13,7 @@ AC_CANONICAL_HOST # Combined check for Microsoft-related bogosities; sets WIN32 if found AX_WIN32 -AC_CHECK_HEADERS(malloc.h stdint.h) +AC_CHECK_HEADERS(malloc.h stdint.h inttypes.h) # may modify CPPFLAGS and CFLAGS AX_CPP_PRECOMP diff --git a/tgt-vvp/eval_bool.c b/tgt-vvp/eval_bool.c index 882170d6e..07c61d682 100644 --- a/tgt-vvp/eval_bool.c +++ b/tgt-vvp/eval_bool.c @@ -20,7 +20,6 @@ /* * This file includes functions for evaluating REAL expressions. */ -# include "_pli_types.h" /* To get the UINT64 format */ # include "vvp_config.h" # include "vvp_priv.h" # include @@ -31,6 +30,15 @@ #ifdef HAVE_STDINT_H # include #endif + +#ifdef HAVE_INTTYPES_H +# ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS 1 +# endif +# include +#else +#endif + # include # include @@ -64,7 +72,7 @@ static int draw_number_bool64(ivl_expr_t exp) } res = allocate_word(); - fprintf(vvp_out, " %%ix/load %d, %" PLI_UINT64_FMT ";\n", res, val); + fprintf(vvp_out, " %%ix/load %d, %" PRIu64 ";\n", res, val); return res; } diff --git a/tgt-vvp/vvp_config.h.in b/tgt-vvp/vvp_config.h.in index 4738a8cd4..66f24faaa 100644 --- a/tgt-vvp/vvp_config.h.in +++ b/tgt-vvp/vvp_config.h.in @@ -32,6 +32,7 @@ # undef HAVE_MALLOC_H # undef HAVE_STDINT_H +# undef HAVE_INTTYPES_H # undef _LARGEFILE_SOURCE # undef _LARGEFILE64_SOURCE