Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings about unknown printf format conversions #1183

Open
Rangi42 opened this issue Oct 27, 2023 · 3 comments
Open

Fix warnings about unknown printf format conversions #1183

Rangi42 opened this issue Oct 27, 2023 · 3 comments
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! builds This affects the build process or release artifacts tests This affects the test suite

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Oct 27, 2023

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 Rangi42 added the bug Unexpected behavior / crashes; to be fixed ASAP! label Oct 27, 2023
@Rangi42
Copy link
Contributor Author

Rangi42 commented Oct 27, 2023

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.

@CasualPokePlayer
Copy link

CasualPokePlayer commented Oct 27, 2023

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

@Rangi42
Copy link
Contributor Author

Rangi42 commented Oct 28, 2023

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 Rangi42 added the tests This affects the test suite label Nov 7, 2023
@Rangi42 Rangi42 added the builds This affects the build process or release artifacts label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! builds This affects the build process or release artifacts tests This affects the test suite
Projects
None yet
Development

No branches or pull requests

2 participants