From 4b6932b8e9eb9b0dbbe6f00a3def539ae6ea08b6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 14 Oct 2005 12:57:00 +0000 Subject: [PATCH] Re-define PRI?64 for mingw. The reason is that mingw does not recognize %I64? as 64 bit formats but assumes integer formats and warngs about int64_t arguments. The mxmsg functions already convert %ll? etc into the proper %I64? values on Windows, so I can use %ll? just to shut up mingw. --- src/common/os.h | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/common/os.h b/src/common/os.h index 7e3f2842d..73a497740 100644 --- a/src/common/os.h +++ b/src/common/os.h @@ -64,6 +64,16 @@ typedef _fsize_t ssize_t; #define PACKED_STRUCTURE __attribute__((__packed__)) #endif // COMP_MSC +#if defined(HAVE_SYS_TYPES_H) +# include +#endif // HAVE_SYS_TYPES_H +#if defined(HAVE_STDINT_H) +# include +#endif // HAVE_STDINT_H +#if defined(HAVE_INTTYPES_H) +# include +#endif // HAVE_INTTYPES_H + #if defined(COMP_MINGW) || defined(COMP_MSC) // For DLL stuff... @@ -77,27 +87,30 @@ typedef _fsize_t ssize_t; # define MTX_DLL_API # endif +# if defined(COMP_MINGW) +// mingw is a special case. It does have inttypes.h declaring +// PRId64 to be I64d, but it warns about "int type format, different +// type argument" if %I64d is used with a int64_t. The mx* functions +// convert %lld to %I64d on mingw/msvc anyway. +# undef PRId64 +# define PRId64 "lld" +# undef PRIu64 +# define PRIu64 "llu" +# undef PRIx64 +# define PRIx64 "llx" +# else +// MSVC doesn't have inttypes, nor the PRI?64 defines. +# define PRId64 "I64d" +# define PRIu64 "I64u" +# define PRIx64 "I64x" +# endif // defined(COMP_MINGW) + #else // COMP_MINGW || COMP_MSC # define MTX_DLL_API + #endif // COMP_MINGW || COMP_MSC -#if defined(HAVE_SYS_TYPES_H) -# include -#endif // HAVE_SYS_TYPES_H -#if defined(HAVE_STDINT_H) -# include -#endif // HAVE_STDINT_H -#if defined(HAVE_INTTYPES_H) -# include -#endif // HAVE_INTTYPES_H - -#if defined(COMP_MSC) -# define PRId64 "I64d" -# define PRIu64 "I64u" -# define PRIx64 "I64x" -#endif - #define LLD "%" PRId64 #define LLU "%" PRIu64