-
Notifications
You must be signed in to change notification settings - Fork 167
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 formatting error on 32-bits targets #1308
Conversation
This raises a lot of `log_warnings` (#1026) diagnostics -- so that's working, good! ;-P
Instead of plain `%z`, you want `%zu` for `size_t`, or `%zi`/`%zd` for `ssize_t`.
Though, I see almost no `z` length modifier usage in GCC. Are there compatibility concerns? (Still with GCC requiring C++11 nowadays?) (For avoidance of doubt: I'm all in favor of using `z` if permissible.)
|
Woops of course should have used |
I believe the The man page for printf states the following:
and 2.1 was released waaaaay before GCC 4.8 / C++11, so I assume we should be in the clear? I think this is definitely something that should go in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
Printing size_t as [unsigned] long (%ld or %lu) raises warnings on 32-bits targets. As the GCC pretty printer doesn't have the equivalent of libc's %z/%zu, fix all formats to use unsigned long and cast values. refs #1229 Signed-off-by: Marc Poulhiès <[email protected]> Co-authored-by: Rainer Orth <[email protected]>
Reverted back to cast as %z spec not supported by GCC pretty printers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah well that's a bit sad :) So no one is interested in patching pp_format
and submitting it? :P
Thought about that, but that was before looking at the code :) I'm not sure that's really worth the effort... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Bit of a shame about %z but I won't blame anyone for not wanting to patch that :P
bors r+ |
Build succeeded: |
Thanks for merging it, forgot about it sorry ! |
Printing size_t as [unsigned] long (%ld or %lu) raises warnings on 32-bits
targets. As the GCC pretty printer doesn't have the equivalent of libc's %z/%zu,
fix all formats to use unsigned long and cast values.
refs #1229
Signed-off-by: Marc Poulhiès [email protected]
Co-authored-by: Rainer Orth [email protected]