[U-Boot] [PATCH 0/10] Provide inttypes.h to avoid 32/64 bit problems with printf()

Simon Glass sjg at chromium.org
Wed Oct 15 12:38:29 CEST 2014


In quite a few situations we have to print a 64-bit value. Unfortunately
the type used for 64-bit can vary depending on the machine. For 64-bit
machines it might be 'long' and for 32-bit machines it might be
'long long'.

As a result we need to use either %ld or %lld depending on the architecture.
Add the inttypes.h header file to provide defines for this and clean up the
code to use these defines in a few places.

The stdint.h file is bundled with recent versions of gcc and it is generally
better to use this rather than our own versions. Add an option to use the
internal stdint.h file.


Gabe Black (2):
  Provide option to avoid defining a custom version of uintptr_t.
  Add some standard headers external code might need

Simon Glass (8):
  ext4: Use inttypes for printf() string
  Use uint64_t for time types
  Use uint64_t instead of u64 in put_dec()
  Tidy up data sizes and function comment in display_options
  x86: Use correct printf() format string for uintptr_t
  scsi: Use correct printf() format string for uintptr_t
  usb: Use correct printf() format string for uintptr_t
  test: Add a simple test to detected warnings with uint64_t, uintptr_t

 README                           |   5 +
 arch/sandbox/include/asm/types.h |   5 +
 arch/x86/include/asm/types.h     |   5 +
 arch/x86/lib/relocate.c          |   3 +-
 common/cmd_scsi.c                |   9 +-
 common/usb_storage.c             |  11 +-
 config.mk                        |   5 +
 fs/ext4/ext4_common.c            |   3 +-
 include/common.h                 |  19 ++-
 include/compiler.h               |  11 +-
 include/inttypes.h               | 287 +++++++++++++++++++++++++++++++++++++++
 include/linux/types.h            |   9 +-
 include/stdlib.h                 |  12 ++
 lib/display_options.c            |  14 +-
 lib/time.c                       |  12 +-
 lib/vsprintf.c                   |   2 +-
 test/stdint/int-types.c          |  13 ++
 test/stdint/test-includes.sh     |  58 ++++++++
 18 files changed, 450 insertions(+), 33 deletions(-)
 create mode 100644 include/inttypes.h
 create mode 100644 include/stdlib.h
 create mode 100644 test/stdint/int-types.c
 create mode 100755 test/stdint/test-includes.sh

-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list