Martin Str|mberg
2014-Nov-22 12:36 UTC
[syslinux] Get rid of printf format warning format ‘%llx’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
Hello. Use <inttypes.h> PRIx64 instead of llx to get rid of gcc warning format ?%llx? expects type ?long long unsigned int?, but argument 2 has type ?uint64_t? -- MartinS diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c index 208abc6..228b6c3 100644 --- a/com32/gpllib/acpi/xsdt.c +++ b/com32/gpllib/acpi/xsdt.c @@ -63,7 +63,7 @@ int parse_xsdt(s_acpi * acpi) /* Let's grab the pointed table header */ char address[16] = { 0 }; - sprintf(address, "%llx", *p); + sprintf(address, "%" PRIx64 , *p); uint64_t *pointed_address = (uint64_t *)strtoul(address, NULL, 16); x->entry[x->entry_count] = pointed_address; diff --git a/com32/hdt/hdt-cli-memory.c b/com32/hdt/hdt-cli-memory.c index c05b7cd..7d0342c 100644 --- a/com32/hdt/hdt-cli-memory.c +++ b/com32/hdt/hdt-cli-memory.c @@ -47,7 +47,7 @@ static void show_memory_e820(int argc __unused, char **argv __unused, more_printf("BIOS-provided physical RAM e820 map:\n"); for (int i = 0; i < count; i++) { get_type(map[i].type, type, 14); - more_printf("%016llx - %016llx %016llx (%s)\n", + more_printf("%016" PRIx64 " - %016" PRIx64 " %016" PRIx64 " (%s)\n", map[i].addr, map[i].size, map[i].addr + map[i].size, remove_spaces(type)); } @@ -60,7 +60,7 @@ static void show_memory_e820(int argc __unused, char **argv __unused, more_printf("Sanitized e820 map:\n"); for (int i = 0; i < nr; i++) { get_type(nm[i].type, type, 14); - more_printf("%016llx - %016llx %016llx (%s)\n", + more_printf("%016" PRIx64 " - %016" PRIx64 " %016" PRIx64 " (%s)\n", nm[i].addr, nm[i].size, nm[i].addr + nm[i].size, remove_spaces(type)); } diff --git a/com32/hdt/hdt-dump-memory.c b/com32/hdt/hdt-dump-memory.c index 5095d3c..4318376 100644 --- a/com32/hdt/hdt-dump-memory.c +++ b/com32/hdt/hdt-dump-memory.c @@ -91,9 +91,9 @@ void dump_e820(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item char begin[24]={0}; char size[24]={0}; char end[24]={0}; - snprintf(begin,sizeof(begin),"0x%016llx",map[i].addr); - snprintf(size,sizeof(size),"0x%016llx",map[i].size); - snprintf(end,sizeof(end),"0x%016llx",map[i].addr+map[i].size); + snprintf(begin,sizeof(begin),"0x%016" PRIx64,map[i].addr); + snprintf(size,sizeof(size),"0x%016" PRIx64,map[i].size); + snprintf(end,sizeof(end),"0x%016" PRIx64,map[i].addr+map[i].size); CREATE_NEW_OBJECT; add_s("memory.segment.start",begin); add_s("memory.segment.size ",size); @@ -108,9 +108,9 @@ void dump_e820(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item char begin[24]={0}; char size[24]={0}; char end[24]={0}; - snprintf(begin,sizeof(begin),"0x%016llx",nm[i].addr); - snprintf(size,sizeof(size),"0x%016llx",nm[i].size); - snprintf(end,sizeof(end),"0x%016llx",nm[i].addr+nm[i].size); + snprintf(begin,sizeof(begin),"0x%016" PRIx64,nm[i].addr); + snprintf(size,sizeof(size),"0x%016" PRIx64,nm[i].size); + snprintf(end,sizeof(end),"0x%016" PRIx64,nm[i].addr+nm[i].size); CREATE_NEW_OBJECT; add_s("sanitized_memory.segment.start",begin); add_s("sanitized_memory.segment.size ",size); diff --git a/com32/hdt/hdt-menu-memory.c b/com32/hdt/hdt-menu-memory.c index 60d741d..56d4ede 100644 --- a/com32/hdt/hdt-menu-memory.c +++ b/com32/hdt/hdt-menu-memory.c @@ -57,10 +57,10 @@ static void compute_e820(struct s_my_menu *menu) for (int j = 0; j < count; j++) { get_type(map[j].type, type, 14); snprintf(buffer, sizeof buffer, - "%016llx - %016llx (%s)", + "%016" PRIx64 " - %016" PRIx64 " (%s)", map[j].addr, map[j].size, remove_spaces(type)); snprintf(statbuffer, sizeof statbuffer, - "%016llx - %016llx (%s)", + "%016" PRIx64 " - %016" PRIx64 " (%s)", map[j].addr, map[j].size, remove_spaces(type)); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c index 5a99bb4..d5f4489 100644 --- a/com32/lib/syslinux/disk.c +++ b/com32/lib/syslinux/disk.c @@ -35,6 +35,7 @@ #include <core.h> #include <dprintf.h> +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -528,9 +529,9 @@ void disk_gpt_part_dump(const struct disk_gpt_part_entry *const gpt_part) char guid_text[37]; dprintf("----------------------------------\n" - "GPT part. LBA first __ : 0x%.16llx\n" - "GPT part. LBA last ___ : 0x%.16llx\n" - "GPT part. attribs ____ : 0x%.16llx\n" + "GPT part. LBA first __ : 0x%.16" PRIx64 "\n" + "GPT part. LBA last ___ : 0x%.16" PRIx64 "\n" + "GPT part. attribs ____ : 0x%.16" PRIx64 "\n" "GPT part. name _______ : '", gpt_part->lba_first, gpt_part->lba_last, gpt_part->attribs); for (i = 0; i < sizeof(gpt_part->name); i++) { @@ -559,11 +560,11 @@ void disk_gpt_header_dump(const struct disk_gpt_header *const gpt) "GPT header size ______ : 0x%.8x\n" "GPT header checksum __ : 0x%.8x\n" "GPT reserved _________ : '%4.4s'\n" - "GPT LBA current ______ : 0x%.16llx\n" - "GPT LBA alternative __ : 0x%.16llx\n" - "GPT LBA first usable _ : 0x%.16llx\n" - "GPT LBA last usable __ : 0x%.16llx\n" - "GPT LBA part. table __ : 0x%.16llx\n" + "GPT LBA current ______ : 0x%.16" PRIx64 "x\n" + "GPT LBA alternative __ : 0x%.16" PRIx64 "x\n" + "GPT LBA first usable _ : 0x%.16" PRIx64 "x\n" + "GPT LBA last usable __ : 0x%.16" PRIx64 "x\n" + "GPT LBA part. table __ : 0x%.16" PRIx64 "x\n" "GPT partition count __ : 0x%.8x\n" "GPT partition size ___ : 0x%.8x\n" "GPT part. table chksum : 0x%.8x\n", diff --git a/com32/modules/meminfo.c b/com32/modules/meminfo.c index fc04792..ce42f88 100644 --- a/com32/modules/meminfo.c +++ b/com32/modules/meminfo.c @@ -71,13 +71,13 @@ static void dump_e820(void) if (oreg.ecx.l >= 24) { /* ebx base length end type */ - printf("%8x %016llx %016llx %016llx %d [%x]", + printf("%8x %016" PRIx64 " %016" PRIx64 " %016" PRIx64 " %d [%x]", ireg.ebx.l, ed.base, ed.len, ed.base + ed.len, ed.type, ed.extattr); } else { /* ebx base length end */ - printf("%8x %016llx %016llx %016llx %d [-]", + printf("%8x %016" PRIx64 " %016" PRIx64 " %016" PRIx64 " %d [-]", ireg.ebx.l, ed.base, ed.len, ed.base + ed.len, ed.type); ed.extattr = 1; }
Geert Stappers
2015-Jan-25 19:48 UTC
[syslinux] Get rid of printf format warning format ???%llx??? expects type ???long long unsigned int???, but argument 2 has type ???uint64_t???
On Sat, Nov 22, 2014 at 01:36:45PM +0100, Martin Str|mberg wrote:> Hello. > > Use <inttypes.h> PRIx64 instead of llx to get rid of gcc warning > format ???%llx??? expects type ???long long unsigned int???, but argument 2 has type ???uint64_t??? > > > -- > MartinS > > diff --git a/com32/gpllib/acpi/xsdt.c b/com32/gpllib/acpi/xsdt.c > index 208abc6..228b6c3 100644 > --- a/com32/gpllib/acpi/xsdt.c > +++ b/com32/gpllib/acpi/xsdt.c > @@ -63,7 +63,7 @@ int parse_xsdt(s_acpi * acpi) > > /* Let's grab the pointed table header */ > char address[16] = { 0 }; > - sprintf(address, "%llx", *p); > + sprintf(address, "%" PRIx64 , *p); > uint64_t *pointed_address = (uint64_t *)strtoul(address, NULL, 16); > > x->entry[x->entry_count] = pointed_address; > diff --git a/com32/hdt/hdt-cli-memory.c b/com32/hdt/hdt-cli-memory.c > index c05b7cd..7d0342c 100644 > --- a/com32/hdt/hdt-cli-memory.c > +++ b/com32/hdt/hdt-cli-memory.c > @@ -47,7 +47,7 @@ static void show_memory_e820(int argc __unused, char **argv __unused, > more_printf("BIOS-provided physical RAM e820 map:\n"); > for (int i = 0; i < count; i++) { > get_type(map[i].type, type, 14); > - more_printf("%016llx - %016llx %016llx (%s)\n", > + more_printf("%016" PRIx64 " - %016" PRIx64 " %016" PRIx64 " (%s)\n",<snip/> For the sake of the archive: Patch is applied in the Development git repository of Gene. @Martin: Thank you for your contribution to Syslinux. Cheers Geert Stappers Who now can unmark 'follow-up' of November 2014 message ------------- volgend deel ------------ Een niet-tekst bijlage is gescrubt... Naam: signature.asc Type: application/pgp-signature Grootte: 836 bytes Omschrijving: Digital signature URL : <http://www.zytor.com/pipermail/syslinux/attachments/20150125/31625c8c/attachment.sig>
Apparently Analagous Threads
- [PATCH] hdt: only display MAC address for network cards
- [PATCH] hdt & gcc -Werror
- [PATCH] com32/disk: add UEFI support
- [PATCH] chain.c: gpt's index/private.index mismatch fix, cosmetic iterator changes
- [RFC/PATCH 1/3] Move partiter from com32/chain to com32/lib/syslinux