"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
lib/delta.c uint64_t warning
To:
gameoftrees@openbsd.org
Date:
Sat, 26 Jul 2025 20:28:45 +0200

Download raw body.

Thread
Seen on FreeBSD:

------------------->
../lib/delta.c:324:35: warning: format specifies type 'unsigned long long' but t
he argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
  324 |                     "expected: %llu", *outsize, result_size);
      |                                ~~~~             ^~~~~~~~~~~
      |                                %lu
../lib/delta.c:393:35: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
  393 |                     "expected: %llu", *outsize, result_size);
      |                                ~~~~             ^~~~~~~~~~~
      |                                %lu
<-------------------

Harmless since both types end up the same size, but ...
There are two ways to fix this:

(1) We can cast the argument to long long.  There are numerous
    precedents for this in the code, but the ones I've checked
    concern types such as time_t or off_t whose size isn't known
    anyway in a portable context.

(2) Use the PRIu64 macro from <inttypes.h>.  There is some
    precedent in the form of PRIdPTR in the got code base.

Which way to go?

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de