From 9c12bcfdc52d7887c26d97bfcb8eb5fc86f2bc1a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 7 Jan 2019 09:32:16 +0100 Subject: Fix format warnings --- cpukit/libdl/rtl-mdreloc-sparc.c | 5 +++-- cpukit/libdl/rtl-obj.c | 2 +- cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 4 ++-- cpukit/libmisc/shell/main_pci.c | 14 +++++++----- cpukit/libpci/pci_bus.c | 8 ++++--- cpukit/libpci/pci_cfg_print_code.c | 11 ++++----- cpukit/libpci/pci_print.c | 23 ++++++++++--------- testsuites/fstests/fsrfsbitmap01/test.c | 36 +++++++++++++++--------------- 8 files changed, 57 insertions(+), 46 deletions(-) diff --git a/cpukit/libdl/rtl-mdreloc-sparc.c b/cpukit/libdl/rtl-mdreloc-sparc.c index 6bc62d5692..c0860a3d3f 100644 --- a/cpukit/libdl/rtl-mdreloc-sparc.c +++ b/cpukit/libdl/rtl-mdreloc-sparc.c @@ -35,6 +35,7 @@ #include +#include #include #include @@ -215,8 +216,8 @@ rtems_rtl_elf_relocate_rela (const rtems_rtl_obj* obj, #ifdef DIAGNOSTIC if (value != 0 && *where != 0) { if (rtems_rtl_trace (RTEMS_RTL_TRACE_RELOC)) - printf("rtl: reloc base_rel(%s): where=%p, *where 0x%lx, " - "addend=0x%lx, base %p\n", + printf("rtl: reloc base_rel(%s): where=%p, *where 0x%" PRIu32 ", " + "addend=0x%" PRIu32 ", base %p\n", rtems_rtl_obj_oname (obj), where, *where, rela->r_addend, sect->base); } diff --git a/cpukit/libdl/rtl-obj.c b/cpukit/libdl/rtl-obj.c index 0f58bf9bda..28a5242ac3 100644 --- a/cpukit/libdl/rtl-obj.c +++ b/cpukit/libdl/rtl-obj.c @@ -428,7 +428,7 @@ rtems_rtl_obj_add_section (rtems_rtl_obj* obj, rtems_chain_append (&obj->sections, §->node); if (rtems_rtl_trace (RTEMS_RTL_TRACE_SECTION)) - printf ("rtl: sect: add: %-2d: %s (%zu) 0x%08lx\n", + printf ("rtl: sect: add: %-2d: %s (%zu) 0x%08" PRIu32 "\n", section, name, size, flags); } return true; diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c index f2c4c10613..b15103e53d 100644 --- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c +++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c @@ -486,7 +486,7 @@ rtems_fdt_shell_tst (int argc, char *argv[]) start = time (NULL); printf ("0x%08" PRIx32 " => (value & 0x%08" PRIx32 ") == 0x%08" PRIx32 \ - " for %" PRIu32 " seconds\n", + " for %ld seconds\n", address, mask, test, rtems_fdt_test_timeout); while ((time (NULL) - start) < rtems_fdt_test_timeout) @@ -533,7 +533,7 @@ rtems_fdt_shell_to (int argc, char *argv[]) if (argc == 1) { - printf ("timeout: %" PRIu32 " seconds\n", rtems_fdt_test_timeout); + printf ("timeout: %ld seconds\n", rtems_fdt_test_timeout); return 0; } diff --git a/cpukit/libmisc/shell/main_pci.c b/cpukit/libmisc/shell/main_pci.c index 57a6e9b542..08fdae78ae 100644 --- a/cpukit/libmisc/shell/main_pci.c +++ b/cpukit/libmisc/shell/main_pci.c @@ -12,6 +12,7 @@ #include "config.h" #endif +#include #include #include #include @@ -136,7 +137,8 @@ static int shell_pci_rX( case 4: result = pci_cfg_r32(pciid, offset, &data32); if (result == PCISTS_OK) - printf(" r32[0x%02x]: 0x%08lx DEC=%lu\n", offset, data32, data32); + printf(" r32[0x%02x]: 0x%08" PRIx32 " DEC=%" PRIu32 "\n", + offset, data32, data32); break; default: @@ -177,7 +179,8 @@ static int shell_pci_wX( case 4: result = pci_cfg_w32(pciid, offset, data); if (result == PCISTS_OK) - printf(" w32[0x%02x]: 0x%08lx DEC=%lu\n", offset, data, data); + printf(" w32[0x%02x]: 0x%08" PRIx32 " DEC=%" PRIu32 "\n", + offset, data, data); break; default: @@ -362,8 +365,8 @@ static int shell_pci_infodev( printf(" DEVICE: 0x%04x\n", dev->device); printf(" SUB VENDOR: 0x%04x\n", dev->subvendor); printf(" SUB DEVICE: 0x%04x\n", dev->subdevice); - printf(" CLASS: 0x%06lx\n", dev->classrev >> 8); - printf(" REVISION: 0x%02lx\n", dev->classrev & 0xff); + printf(" CLASS: 0x%06" PRIx32 "\n", dev->classrev >> 8); + printf(" REVISION: 0x%02" PRIx32 "\n", dev->classrev & 0xff); printf(" IRQ: %d\n", dev->sysirq); res_avail = 0; @@ -387,7 +390,8 @@ static int shell_pci_infodev( continue; } - printf(" %s[%d]: %08lx-%08lx\n", str1, i, res->start, res->end - 1); + printf(" %s[%d]: %08" PRIx32 "-%08" PRIx32 "\n", + str1, i, res->start, res->end - 1); } if (res_avail == 0) diff --git a/cpukit/libpci/pci_bus.c b/cpukit/libpci/pci_bus.c index 2172e720bd..115deebd8d 100644 --- a/cpukit/libpci/pci_bus.c +++ b/cpukit/libpci/pci_bus.c @@ -26,6 +26,7 @@ /* On small systems undefine PCIBUS_INFO to avoid sprintf get dragged in */ #define PCIBUS_INFO +#include #include #include #include @@ -301,7 +302,7 @@ void pcibus_dev_info( sprintf(buf, "LOCATION: BUS:SLOT:FUNCTION [%x:%x:%x]", PCI_DEV_EXPAND(devinfo->pcidev)); print_line(p, buf); - sprintf(buf, "PCIID 0x%lx", (uint32_t)devinfo->pcidev); + sprintf(buf, "PCIID 0x%" PRIx16 "", devinfo->pcidev); print_line(p, buf); sprintf(buf, "VENDOR ID: %04x", devinfo->id.vendor); print_line(p, buf); @@ -311,7 +312,7 @@ void pcibus_dev_info( print_line(p, buf); sprintf(buf, "SUBDEV ID: %04x", devinfo->id.subdevice); print_line(p, buf); - sprintf(buf, "CLASS: %lx", devinfo->id.class); + sprintf(buf, "CLASS: %" PRIx32, devinfo->id.class); print_line(p, buf); sprintf(buf, "REVISION: %x", devinfo->rev); print_line(p, buf); @@ -343,7 +344,8 @@ void pcibus_dev_info( if (!pcibusres->size) continue; - sprintf(buf, " %s[%d]: %08lx-%08lx [PCIADR %lx]", + sprintf(buf, " %s[%d]: %08" PRIx32 "-%08" PRIx32 + " [PCIADR %" PRIx32 "]", str1, i, pcibusres->address, pcibusres->address + pcibusres->size - 1, pcistart); print_line(p, buf); diff --git a/cpukit/libpci/pci_cfg_print_code.c b/cpukit/libpci/pci_cfg_print_code.c index a921f00529..e758fa661a 100644 --- a/cpukit/libpci/pci_cfg_print_code.c +++ b/cpukit/libpci/pci_cfg_print_code.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -49,12 +50,12 @@ static void pci_cfg_print_resources(struct pci_res *resources, char *prefix) } printf("%s{\n", prefix); printf("%s\t.next = NULL,\n", prefix); - printf("%s\t.size = 0x%08lx,\n", prefix, res->size); - printf("%s\t.boundary = 0x%08lx,\n", prefix, res->boundary); + printf("%s\t.size = 0x%08" PRIx32 ",\n", prefix, res->size); + printf("%s\t.boundary = 0x%08" PRIx32 ",\n", prefix, res->boundary); printf("%s\t.flags = 0x%x,\n", prefix, res->flags); printf("%s\t.bar = %d,\n", prefix, i); - printf("%s\t.start = 0x%08lx,\n", prefix, res->start); - printf("%s\t.end = 0x%08lx,\n", prefix, res->end); + printf("%s\t.start = 0x%08" PRIx32 ",\n", prefix, res->start); + printf("%s\t.end = 0x%08" PRIx32 ",\n", prefix, res->end); printf("%s},\n", prefix); } } @@ -88,7 +89,7 @@ static void pci_cfg_print_device(struct pci_dev *dev, char *prefix) printf("%s.device = 0x%04x,\n", prefix, dev->device); printf("%s.subvendor = 0x%04x,\n", prefix, dev->subvendor); printf("%s.subdevice = 0x%04x,\n", prefix, dev->subdevice); - printf("%s.classrev = 0x%08lx,\n", prefix, dev->classrev); + printf("%s.classrev = 0x%08" PRIx32 ",\n", prefix, dev->classrev); printf("%s.command = 0,\n", prefix); } diff --git a/cpukit/libpci/pci_print.c b/cpukit/libpci/pci_print.c index e0835d9323..7c021d8df9 100644 --- a/cpukit/libpci/pci_print.c +++ b/cpukit/libpci/pci_print.c @@ -7,6 +7,7 @@ * http://www.rtems.org/license/LICENSE. */ +#include #include #include #include @@ -42,11 +43,12 @@ void pci_print_dev(pci_dev_t dev) PCI_CFG_R32(dev, PCIR_VENDOR, &id); printf("\nBus %x Slot %x function: %x [0x%x] %s\n", PCI_DEV_EXPAND(dev), dev, str); - printf("\tVendor id: 0x%lx, device id: 0x%lx\n", + printf("\tVendor id: 0x%" PRIx32 ", device id: 0x%" PRIx32 "\n", id & 0xffff, id >> 16); if (maxbars == 2) { PCI_CFG_R32(dev, PCIR_PRIBUS_1, &tmp); - printf("\tPrimary: %lx Secondary: %lx Subordinate: %lx\n", + printf("\tPrimary: %" PRIx32 " Secondary: %" PRIx32 + " Subordinate: %" PRIx32 "\n", tmp & 0xff, (tmp >> 8) & 0xff, (tmp >> 16) & 0xff); } @@ -82,7 +84,8 @@ void pci_print_dev(pci_dev_t dev) str = "MB"; tmp2 = tmp2 / (1024*1024); } - printf("\tBAR %d: %lx [%lu%s]\n", pos, tmp, tmp2, str); + printf("\tBAR %d: %" PRIx32 " [%" PRIu32 "%s]\n", + pos, tmp, tmp2, str); } } @@ -105,7 +108,7 @@ void pci_print_dev(pci_dev_t dev) tmp2 = tmp2 / (1024*1024); } str2 = tmp & 1 ? "ENABLED" : "DISABLED"; - printf("\tROM: %08lx [%lu%s] (%s)\n", + printf("\tROM: %08" PRIx32 " [%" PRIu32 "%s] (%s)\n", tmp, tmp2, str, str2); } @@ -122,8 +125,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tI/O: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tI/O: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } PCI_CFG_R32(dev, 0x20, &tmp); @@ -133,8 +136,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tMEMIO: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tMEMIO: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } PCI_CFG_R32(dev, 0x24, &tmp); @@ -144,8 +147,8 @@ void pci_print_dev(pci_dev_t dev) str = "ENABLED"; if (limit < base) str = "DISABLED"; - printf("\tMEM: BASE: 0x%08lx, LIMIT: 0x%08lx (%s)\n", - base, limit, str); + printf("\tMEM: BASE: 0x%08" PRIx32 ", LIMIT: 0x%08" + PRIx32 " (%s)\n", base, limit, str); } } printf("\n"); diff --git a/testsuites/fstests/fsrfsbitmap01/test.c b/testsuites/fstests/fsrfsbitmap01/test.c index e92a538091..ba67b8642e 100644 --- a/testsuites/fstests/fsrfsbitmap01/test.c +++ b/testsuites/fstests/fsrfsbitmap01/test.c @@ -48,7 +48,7 @@ rtems_rfs_bitmap_ut_test_range (rtems_rfs_bitmap_control* control, int rc = rtems_rfs_bitmap_map_test (control, bit + count, &result); if (rc > 0) { - printf (" %2d. Test bit %" PRId32 " in range (%" PRId32 ",%ld] is %s: ", + printf (" %2d. Test bit %" PRId32 " in range (%" PRId32 ",%zu] is %s: ", test, bit + count, bit, bit + size - 1, !set ? "set" : "clear"); printf ("FAIL (%s)\n", strerror (rc)); return false; @@ -57,14 +57,14 @@ rtems_rfs_bitmap_ut_test_range (rtems_rfs_bitmap_control* control, result = !result; if (!result) { - printf (" %2d. Test bit %" PRId32 " in range (%" PRId32 ",%ld] is %s: ", + printf (" %2d. Test bit %" PRId32 " in range (%" PRId32 ",%zu] is %s: ", test, bit + count, bit, bit + size - 1, !set ? "set" : "clear"); printf (" %s\n", !result ? "pass" : "FAIL"); return false; } } - printf (" %2d. Test bit range (%" PRId32 ",%ld] all %s: pass\n", + printf (" %2d. Test bit range (%" PRId32 ",%zu] all %s: pass\n", test, bit, bit + size - 1, set ? "set" : "clear"); return true; @@ -91,7 +91,7 @@ rtems_rfs_bitmap_ut_alloc_seq_test (rtems_rfs_bitmap_control* control, for (i = 0; i < size; i++) rtems_rfs_bitmap_map_clear (control, bit + i); - printf (" %2d. Cleared bits (%" PRId32 ", %ld] (%zd)\n", + printf (" %2d. Cleared bits (%" PRId32 ", %zu] (%zu)\n", test, bit, bit + size - 1, size); for (i = 0; i < rtems_rfs_bitmap_element_bits (); i++) @@ -128,7 +128,7 @@ rtems_rfs_bitmap_ut_alloc_seq_test (rtems_rfs_bitmap_control* control, } } - printf (" %2d. Alloc'ed all bits (%" PRId32 ", %ld] (%zd)\n", + printf (" %2d. Alloc'ed all bits (%" PRId32 ", %zu] (%zu)\n", test, bit, bit + size - 1, size); return true; @@ -184,7 +184,7 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) handle.buffer = &buffer; handle.bnum = 1; - printf ("\nRFS Bitmap Test : size = %zd (%zd)\n", + printf ("\nRFS Bitmap Test : size = %zu (%zu)\n", size, rtems_rfs_bitmap_elements (size)); rc = rtems_rfs_bitmap_open (&control, &fs, &handle, size, 1); @@ -220,7 +220,7 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) rc = rtems_rfs_bitmap_map_alloc (&control, size - 1, &result, &bit); result = result && (bit == (size - 1)); - printf (" 4. Find bit (size - 1) with seed = (size - 1) (%zd): %s (%s): bit = %" PRId32 "\n", + printf (" 4. Find bit (size - 1) with seed = (size - 1) (%zu): %s (%s): bit = %" PRId32 "\n", size - 1, result ? "pass" : "FAIL", strerror (rc), bit); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); @@ -233,7 +233,7 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); rc = rtems_rfs_bitmap_map_test (&control, size - 1, &result); - printf (" 6. Test bit (size - 1) (%zd): %s (%s)\n", + printf (" 6. Test bit (size - 1) (%zu): %s (%s)\n", size - 1, result ? "pass" : "FAIL", strerror (rc)); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); @@ -284,7 +284,7 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); rc = rtems_rfs_bitmap_map_clear (&control, size - 1); - printf (" 14. Clear bit (size - 1) (%zd): %s (%s)\n", + printf (" 14. Clear bit (size - 1) (%zu): %s (%s)\n", size - 1, rc == 0 ? "pass" : "FAIL", strerror (rc)); rtems_rfs_exit_on_error (rc, false, &control, buffer.buffer); @@ -300,18 +300,18 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) rc = rtems_rfs_bitmap_map_alloc (&control, size / 2, &result, &bit); result = result && (bit == 0); - printf (" 17. Find bit with seed = (size / 2) (%zd): %s (%s): bit = %" PRId32 "\n", + printf (" 17. Find bit with seed = (size / 2) (%zu): %s (%s): bit = %" PRId32 "\n", size / 2, result ? "pass" : "FAIL", strerror (rc), bit); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); rc = rtems_rfs_bitmap_map_clear (&control, size - 1); - printf (" 18. Clear bit (size - 1) (%zd): %s, (%s)\n", + printf (" 18. Clear bit (size - 1) (%zu): %s, (%s)\n", size - 1, rc == 0 ? "pass" : "FAIL", strerror (rc)); rtems_rfs_exit_on_error (rc, false, &control, buffer.buffer); rc = rtems_rfs_bitmap_map_alloc (&control, size / 2, &result, &bit); result = result && (bit == (size - 1)); - printf (" 19. Find bit with seed = (size / 2) (%zd): %s (%s): bit = %" PRId32 "\n", + printf (" 19. Find bit with seed = (size / 2) (%zu): %s (%s): bit = %" PRId32 "\n", size / 2, result ? "pass" : "FAIL", strerror (rc), bit); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); @@ -321,17 +321,17 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) rc = rtems_rfs_bitmap_map_alloc (&control, (size / 2) - 1, &result, &bit); result = result && (bit == 0); - printf (" 21. Find bit with seed = ((size / 2) - 1) (%zd): %s (%s): bit = %" PRId32 "\n", + printf (" 21. Find bit with seed = ((size / 2) - 1) (%zu): %s (%s): bit = %" PRId32 "\n", (size / 2) - 1, result ? "pass" : "FAIL", strerror (rc), bit); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); rc = rtems_rfs_bitmap_map_clear (&control, size - 1); - printf (" 22. Clear bit (size - 1) (%zd): %s (%s)\n", + printf (" 22. Clear bit (size - 1) (%zu): %s (%s)\n", size - 1, rc == 0 ? "pass" : "FAIL", strerror (rc)); rc = rtems_rfs_bitmap_map_alloc (&control, (size / 2) - 1, &result, &bit); result = result && (bit == (size - 1)); - printf (" 23. Find bit with seed = ((size / 2) - 1) (%zd): %s (%s): bit = %" PRId32 "\n", + printf (" 23. Find bit with seed = ((size / 2) - 1) (%zu): %s (%s): bit = %" PRId32 "\n", (size / 2) - 1, result ? "pass" : "FAIL", strerror (rc), bit); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); @@ -372,13 +372,13 @@ rtems_rfs_bitmap_ut_test_bitmap (size_t size) clear = rtems_rfs_bitmap_map_free (&control); result = clear == (last_bit - first_bit); - printf (" 27. Check free count is %zd: %" PRId32 ": %s (%s)\n", + printf (" 27. Check free count is %zu: %" PRId32 ": %s (%s)\n", clear, last_bit - first_bit, result ? "pass" : "FAIL", strerror (rc)); rc = rtems_rfs_bitmap_create_search (&control); result = clear == rtems_rfs_bitmap_map_free (&control); - printf (" 28. Create search check free count is %zd: %zd: %s (%s)\n", + printf (" 28. Create search check free count is %zu: %zu: %s (%s)\n", clear, rtems_rfs_bitmap_map_free (&control), result ? "pass" : "FAIL", strerror (rc)); rtems_rfs_exit_on_error (rc, !result, &control, buffer.buffer); @@ -454,7 +454,7 @@ static void rtems_rfs_bitmap_unit_test (void) { printf (" Bit set value : %d\n", RTEMS_RFS_BITMAP_BIT_SET); printf (" Bit clear value : %d\n", RTEMS_RFS_BITMAP_BIT_CLEAR); - printf (" Num bit per element : %zd\n", rtems_rfs_bitmap_element_bits ()); + printf (" Num bit per element : %zu\n", rtems_rfs_bitmap_element_bits ()); #if INT_MAX >= 0x23984237 srand (0x23984237); -- cgit v1.2.3