bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix inttypes.h format constants for uintptr_t and intptr_t.


From: Samuel Thibault
Subject: Re: [PATCH] Fix inttypes.h format constants for uintptr_t and intptr_t.
Date: Tue, 27 Dec 2022 21:40:40 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Flavio Cruz, le lun. 26 déc. 2022 19:15:38 -0500, a ecrit:
> The format constants are not correct for 32 bits and there was
> duplication for PRIx* constants (replaced with octal constants).
> 
> Fixed a few format warnings too.
> ---
>  i386/i386at/model_dep.c |  5 +++--
>  include/inttypes.h      | 20 +++++++++++---------
>  2 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
> index 0fc99406..f677e134 100644
> --- a/i386/i386at/model_dep.c
> +++ b/i386/i386at/model_dep.c
> @@ -32,6 +32,7 @@
>   *   Basic initialization for I386 - ISA bus machines.
>   */
>  
> +#include <inttypes.h>
>  #include <string.h>
>  
>  #include <device/cons.h>
> @@ -607,7 +608,7 @@ void c_boot_entry(vm_offset_t bi)
>               strtab_size = (vm_offset_t)phystokv(boot_info.shdr_size);
>               kern_sym_end = kern_sym_start + 4 + symtab_size + strtab_size;
>  
> -             printf("kernel symbol table at %08lx-%08lx (%ld,%ld)\n",
> +             printf("kernel symbol table at %08" PRIxPTR "-%08" PRIxPTR " 
> (%ld,%ld)\n",
>                      kern_sym_start, kern_sym_end,
>                      (unsigned long) symtab_size, (unsigned long) 
> strtab_size);
>       }
> @@ -620,7 +621,7 @@ void c_boot_entry(vm_offset_t bi)
>               elf_shdr_addr = (vm_offset_t)phystokv(boot_info.shdr_addr);
>               elf_shdr_shndx = boot_info.shdr_strndx;
>  
> -             printf("ELF section header table at %08lx\n", elf_shdr_addr);
> +             printf("ELF section header table at %08" PRIxPTR "\n", 
> elf_shdr_addr);
>       }
>  #endif       /* MACH_KDB */
>  #endif       /* MACH_XEN */
> diff --git a/include/inttypes.h b/include/inttypes.h
> index ebafb67a..353984a0 100644
> --- a/include/inttypes.h
> +++ b/include/inttypes.h
> @@ -25,38 +25,40 @@
>  
>  #ifdef __x86_64__
>  #define __64PREFIX "l"
> +#define __PTRPREFIX "l"
>  #else
>  #define __64PREFIX "ll"
> +#define __PTRPREFIX
>  #endif
>  
>  #define PRId8                "d"
>  #define PRId16               "d"
>  #define PRId32               "d"
>  #define PRId64               __64PREFIX"d"
> -#define PRIdPTR              __64PREFIX"d"
> +#define PRIdPTR              __PTRPREFIX"d"
>  
>  #define PRIi8                "i"
>  #define PRIi16               "i"
>  #define PRIi32               "i"
>  #define PRIi64               __64PREFIX"i"
> -#define PRIiPTR              __64PREFIX"i"
> +#define PRIiPTR              __PTRPREFIX"i"
>  
>  #define PRIu8                "u"
>  #define PRIu16               "u"
>  #define PRIu32               "u"
>  #define PRIu64               __64PREFIX"u"
> -#define PRIuPTR              __64PREFIX"u"
> +#define PRIuPTR              __PTRPREFIX"u"
>  
>  #define PRIx8                "x"
>  #define PRIx16               "x"
>  #define PRIx32               "x"
>  #define PRIx64               __64PREFIX"x"
> -#define PRIxPTR              __64PREFIX"x"
> +#define PRIxPTR              __PTRPREFIX"x"
>  
> -#define PRIx8                "x"
> -#define PRIx16               "x"
> -#define PRIx32               "x"
> -#define PRIx64               __64PREFIX"x"
> -#define PRIxPTR              __64PREFIX"x"
> +#define PRIo8                "o"
> +#define PRIo16               "o"
> +#define PRIo32               "o"
> +#define PRIo64               __64PREFIX"o"
> +#define PRIoPTR              __PTRPREFIX"o"
>  
>  #endif /* _INTTYPES_H_ */
> -- 
> 2.37.2
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]