rgbds icon indicating copy to clipboard operation
rgbds copied to clipboard

Fix CI warnings about unknown printf format conversions

Open Rangi42 opened this issue 9 months ago • 3 comments

The Windows builds give a lot of "unknown conversion type character ‘z’ in format" warnings for %zu for size_t, and some about ‘j’ for %j for intmax_t. We could define custom PRI*-like macros for those data types, depending on the platform's size of those types.

The combinations we use: %zd %zu %jd %ju %jx

Rangi42 avatar Oct 27 '23 16:10 Rangi42

MSVC uses nonstandard %Iu instead of %zu for size_t, %I instead of %t for ptrdiff_t, and doesn't support %j for intmax_t.

Rangi42 avatar Oct 27 '23 17:10 Rangi42

Those are old non-standard extensions in MS's CRT, which even then you'd have to be linking to the ancient msvcrt C runtime to have issues here. The newer ucrt C runtime (around since 2015) support %zu and %t and %j just fine: https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-140#size-prefixes-for-printf-and-wprintf-format-type-specifiers

CasualPokePlayer avatar Oct 27 '23 17:10 CasualPokePlayer

So it's specifically windows-xbuild that has this issue, because it compiles with mingw32-gcc / mingw32-g++. Annoying but not a significant issue.

Rangi42 avatar Oct 28 '23 00:10 Rangi42