Always define [u]cell in terms of fixed-width types, so that their PRI* macros can be reused.
Signed-off-by: Andreas Färber andreas.faerber@web.de --- include/arch/amd64/types.h | 10 +++++----- include/arch/ppc/types.h | 12 +++++++----- include/arch/sparc32/types.h | 12 +++++++----- include/arch/sparc64/types.h | 16 +++++++++------- include/arch/x86/types.h | 10 +++++----- kernel/cross.h | 8 ++++---- 6 files changed, 37 insertions(+), 31 deletions(-)
diff --git a/include/arch/amd64/types.h b/include/arch/amd64/types.h index 7b4f587..83fd3e1 100644 --- a/include/arch/amd64/types.h +++ b/include/arch/amd64/types.h @@ -11,7 +11,7 @@ #ifndef __TYPES_H #define __TYPES_H
-#include <stdint.h> +#include <inttypes.h>
/* endianess */ #include "autoconf.h" @@ -24,12 +24,12 @@ typedef uint64_t phys_addr_t;
/* cell based types */
-typedef long long cell; -typedef unsigned long long ucell; -typedef __int128_t dcell; +typedef int64_t cell; +typedef uint64_t ucell; +typedef __int128_t dcell; typedef __uint128_t ducell;
-#define FMT_ucellx "%016llx" +#define FMT_ucellx "%016" PRIx64
typedef int64_t prom_arg_t; typedef uint64_t prom_uarg_t; diff --git a/include/arch/ppc/types.h b/include/arch/ppc/types.h index b596428..cb1cc28 100644 --- a/include/arch/ppc/types.h +++ b/include/arch/ppc/types.h @@ -12,7 +12,7 @@ #include "mconfig.h"
#ifdef BOOTSTRAP -#include <stdint.h> +#include <inttypes.h> #else typedef unsigned char uint8_t; typedef unsigned short uint16_t; @@ -29,9 +29,11 @@ typedef long intptr_t; #define PRId32 "d" #define PRIu32 "u" #define PRIx32 "x" +#define PRIX32 "X" #define PRId64 "lld" #define PRIu64 "llu" #define PRIx64 "llx" +#define PRIX64 "llX" #endif
/* endianess */ @@ -53,10 +55,10 @@ typedef uint32_t ucell; typedef int64_t dcell; typedef uint64_t ducell;
-#define FMT_cell "%d" -#define FMT_ucell "%u" -#define FMT_ucellx "%08x" -#define FMT_ucellX "%08X" +#define FMT_cell "%" PRId32 +#define FMT_ucell "%" PRIu32 +#define FMT_ucellx "%08" PRIx32 +#define FMT_ucellX "%08" PRIX32
typedef int32_t prom_arg_t; typedef uint32_t prom_uarg_t; diff --git a/include/arch/sparc32/types.h b/include/arch/sparc32/types.h index e3a96ff..f765874 100644 --- a/include/arch/sparc32/types.h +++ b/include/arch/sparc32/types.h @@ -12,7 +12,7 @@ #include "mconfig.h"
#ifdef BOOTSTRAP -#include <stdint.h> +#include <inttypes.h> #else typedef unsigned char uint8_t; typedef unsigned short uint16_t; @@ -29,9 +29,11 @@ typedef long intptr_t; #define PRId32 "d" #define PRIu32 "u" #define PRIx32 "x" +#define PRIX32 "X" #define PRId64 "lld" #define PRIu64 "llu" #define PRIx64 "llx" +#define PRIX64 "llX" #endif
/* endianess */ @@ -50,10 +52,10 @@ typedef uint32_t ucell; typedef long long dcell; typedef unsigned long long ducell;
-#define FMT_cell "%ld" -#define FMT_ucell "%lu" -#define FMT_ucellx "%08x" -#define FMT_ucellX "%08X" +#define FMT_cell "%" PRId32 +#define FMT_ucell "%" PRIu32 +#define FMT_ucellx "%08" PRIx32 +#define FMT_ucellX "%08" PRIX32
typedef int32_t prom_arg_t; typedef uint32_t prom_uarg_t; diff --git a/include/arch/sparc64/types.h b/include/arch/sparc64/types.h index d5a3fca..8784331 100644 --- a/include/arch/sparc64/types.h +++ b/include/arch/sparc64/types.h @@ -12,7 +12,7 @@ #include "mconfig.h"
#ifdef BOOTSTRAP -#include <stdint.h> +#include <inttypes.h> #else typedef unsigned char uint8_t; typedef unsigned short uint16_t; @@ -29,9 +29,11 @@ typedef long intptr_t; #define PRId32 "d" #define PRIu32 "u" #define PRIx32 "x" +#define PRIX32 "X" #define PRId64 "lld" #define PRIu64 "llu" #define PRIx64 "llx" +#define PRIX64 "llX" #endif
/* endianess */ @@ -43,13 +45,13 @@ typedef uint64_t phys_addr_t; #define FMT_plx "%016" PRIx64
/* cell based types */ -typedef long long cell; -typedef unsigned long long ucell; +typedef int64_t cell; +typedef uint64_t ucell;
-#define FMT_cell "%lld" -#define FMT_ucell "%llu" -#define FMT_ucellx "%016llx" -#define FMT_ucellX "%016llX" +#define FMT_cell "%" PRId64 +#define FMT_ucell "%" PRIu64 +#define FMT_ucellx "%016" PRIx64 +#define FMT_ucellX "%016" PRIX64
typedef int64_t prom_arg_t; typedef uint64_t prom_uarg_t; diff --git a/include/arch/x86/types.h b/include/arch/x86/types.h index f533397..e06ab9b 100644 --- a/include/arch/x86/types.h +++ b/include/arch/x86/types.h @@ -11,7 +11,7 @@ #ifndef __TYPES_H #define __TYPES_H
-#include <stdint.h> +#include <inttypes.h>
/* endianess */
@@ -30,10 +30,10 @@ typedef uint32_t ucell; typedef int64_t dcell; typedef uint64_t ducell;
-#define FMT_cell "%ld" -#define FMT_ucell "%lu" -#define FMT_ucellx "%08x" -#define FMT_ucellX "%08X" +#define FMT_cell "%" PRId32 +#define FMT_ucell "%" PRIu32 +#define FMT_ucellx "%08" PRIx32 +#define FMT_ucellX "%08" PRIX32
typedef int32_t prom_arg_t; typedef uint32_t prom_uarg_t; diff --git a/kernel/cross.h b/kernel/cross.h index 50d55e7..9dd656f 100644 --- a/kernel/cross.h +++ b/kernel/cross.h @@ -103,11 +103,11 @@ /* bit width handling */
#if BITS==32 -#define FMT_CELL_x "x" -#define FMT_CELL_d "d" +#define FMT_CELL_x PRIx32 +#define FMT_CELL_d PRId32 #else -#define FMT_CELL_x "llx" -#define FMT_CELL_d "lld" +#define FMT_CELL_x PRIx64 +#define FMT_CELL_d PRId64 #endif
#ifdef NATIVE_BITWIDTH_SMALLER_THAN_HOST_BITWIDTH