From 09fca224ec0c1899c0c36dc4db48e737af313a0b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 10 Nov 2020 23:37:04 +0900 Subject: [PATCH] arch/sim/include/inttypes.h: Fix intptr_t 64-bit size_t/intptr_t/ptrdiff_t are long, not long long, for macOS and Linux. Note: we don't care CONFIG_SIM_M32 on macOS. macOS: spacetanuki% uname -a Darwin spacetanuki.lan 18.7.0 Darwin Kernel Version 18.7.0: Mon Aug 31 20:53:32 PDT 2020; root:xnu-4903.278.44~1/RELEASE_X86_64 x86_64 spacetanuki% cc --version Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin spacetanuki% cc -dM -E - < /dev/null|grep __SIZE_TYPE__ #define __SIZE_TYPE__ long unsigned int spacetanuki% cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__ #define __SIZE_TYPE__ long unsigned int spacetanuki% Linux: root@4c2e9e83ac82:/tools# uname -a Linux 4c2e9e83ac82 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux root@4c2e9e83ac82:/tools# cc --version cc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@4c2e9e83ac82:/tools# cc -dM -E - < /dev/null|grep __SIZE_TYPE__ #define __SIZE_TYPE__ long unsigned int root@4c2e9e83ac82:/tools# cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__ #define __SIZE_TYPE__ unsigned int root@4c2e9e83ac82:/tools# --- arch/sim/include/inttypes.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/sim/include/inttypes.h b/arch/sim/include/inttypes.h index e0d716a8238da..c45e110b760ea 100644 --- a/arch/sim/include/inttypes.h +++ b/arch/sim/include/inttypes.h @@ -118,17 +118,17 @@ # define UINT64_C(x) x ## ull #if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32) -# define PRIdPTR "lld" -# define PRIiPTR "lli" -# define PRIoPTR "llo" -# define PRIuPTR "llu" -# define PRIxPTR "llx" -# define PRIXPTR "llX" -# define SCNdPTR "lld" -# define SCNiPTR "lli" -# define SCNoPTR "llo" -# define SCNuPTR "llu" -# define SCNxPTR "llx" +# define PRIdPTR "ld" +# define PRIiPTR "li" +# define PRIoPTR "lo" +# define PRIuPTR "lu" +# define PRIxPTR "lx" +# define PRIXPTR "lX" +# define SCNdPTR "ld" +# define SCNiPTR "li" +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" #else # define PRIdPTR "d" # define PRIiPTR "i"