Skip to content

error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') #200

@cmoad

Description

@cmoad

I am getting the following errors in master. Changing the formatters to %ll fixes the problem. Any ideas why I am seeing this? OS 10.13.4

☁  hyperkit [master] make -j4
cc src/lib/firmware/bootrom.c
src/lib/firmware/bootrom.c:95:49: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'off_t' (aka 'long long')
      [-Werror,-Wformat]
                fprintf(stderr, "Invalid bootrom size %zd\n", sbuf.st_size);
                                                      ~~~     ^~~~~~~~~~~~
                                                      %lld
src/lib/firmware/bootrom.c:101:22: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'off_t' (aka 'long long')
      [-Werror,-Wformat]
                    "page size\n", sbuf.st_size);
                                   ^~~~~~~~~~~~
src/lib/firmware/bootrom.c:112:4: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'off_t' (aka 'long long')
      [-Werror,-Wformat]
                        sbuf.st_size);
                        ^~~~~~~~~~~~
3 errors generated.
make: *** [build/lib/firmware/bootrom.o] Error 1
diff --git a/src/lib/firmware/bootrom.c b/src/lib/firmware/bootrom.c
index 02cdecd..3ae2b6a 100644
--- a/src/lib/firmware/bootrom.c
+++ b/src/lib/firmware/bootrom.c
@@ -92,12 +92,12 @@ uint64_t bootrom_load(void)
         * MMIO space (e.g. APIC, HPET, MSI).
         */
        if (sbuf.st_size > MAX_BOOTROM_SIZE || sbuf.st_size < XHYVE_PAGE_SIZE) {
-               fprintf(stderr, "Invalid bootrom size %zd\n", sbuf.st_size);
+               fprintf(stderr, "Invalid bootrom size %lld\n", sbuf.st_size);
                goto done;
        }

        if (sbuf.st_size & XHYVE_PAGE_MASK) {
-               fprintf(stderr, "Bootrom size %zd is not a multiple of the "
+               fprintf(stderr, "Bootrom size %lld is not a multiple of the "
                    "page size\n", sbuf.st_size);
                goto done;
        }
@@ -108,7 +108,7 @@ uint64_t bootrom_load(void)
        ptr = vmm_mem_alloc(gpa, (size_t)sbuf.st_size);
        if (!ptr) {
                fprintf(stderr,
-                       "Failed to allocate %zd bytes of memory for bootrom\n",
+                       "Failed to allocate %lld bytes of memory for bootrom\n",
                        sbuf.st_size);
                rv = -1;
                goto done;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions