Skip to content
  • Roman Bolshakov's avatar
    lib: x86: Use portable format macros for uint32_t · d26193a0
    Roman Bolshakov authored
    
    
    Compilation of the files fails on ARCH=i386 with i686-elf gcc because
    they use "%x" or "%d" format specifier that does not match the actual
    size of uint32_t:
    
    x86/s3.c: In function ‘main’:
    x86/s3.c:53:35: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘u32’ {aka ‘long unsigned int’}
    [-Werror=format=]
       53 |  printf("PM1a event registers at %x\n", fadt->pm1a_evt_blk);
          |                                  ~^     ~~~~~~~~~~~~~~~~~~
          |                                   |         |
          |                                   |         u32 {aka long unsigned int}
          |                                   unsigned int
          |                                  %lx
    
    Use PRIx32 instead of "x" and PRId32 instead of "d" to take into account
    u32_long case.
    
    Cc: Alex Bennée <alex.bennee@linaro.org>
    Cc: Andrew Jones <drjones@redhat.com>
    Cc: Cameron Esfahani <dirty@apple.com>
    Signed-off-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
    Message-Id: <20200901085056.33391-6-r.bolshakov@yadro.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    d26193a0