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

jansson: -Wformat-invalid-specifier #1460

Closed
patrickdowling opened this issue Mar 21, 2024 · 2 comments
Closed

jansson: -Wformat-invalid-specifier #1460

patrickdowling opened this issue Mar 21, 2024 · 2 comments

Comments

@patrickdowling
Copy link

Noticed this in passing and it reproduces in this repo. Apologies if I'm missing something obvious...

../subprojects/jansson-2.14/src/dump.c:238:65: warning: invalid conversion specifier 'P' [-Wformat-invalid-specifier]

AFAICT this comes from jansson/meson.build:58

cdata.set_quoted('JSON_INTEGER_FORMAT', 'PRId64')

so the resulting format string is ...%" "PRId64" which is not what we wanted given PRId64 is macro?

  • The obvious change to use cdata.set doesn't compile without also patching dump.c to #include <inttypes.h>. Not sure why since HAVE_INTTYPES_H is 1.

  • Using cdata.set_quoted(..., 'lld') compiles without warnings, but ignores all the usual config. That smells like a "works for me" solution :)

While poking around I found a related suggestion in the jansson repo to switch to intmax_t which might also make it easier.

FWIW

Host machine cpu family: x86_64
Host machine cpu: x86_64
jansson| C compiler for the host machine: ccache cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.1.0.2.5)")

Thanks!

@neheb
Copy link
Collaborator

neheb commented May 16, 2024

fixed.

edit: eh mostly. macOS warns but should work otherwise.

@neheb neheb closed this as completed May 16, 2024
@patrickdowling
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants