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 formatting error on 32-bits targets #1308

Merged
merged 1 commit into from
Jun 17, 2022
Merged

Fix formatting error on 32-bits targets #1308

merged 1 commit into from
Jun 17, 2022

Conversation

dkm
Copy link
Member

@dkm dkm commented Jun 12, 2022

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]

@tschwinge
Copy link
Member

tschwinge commented Jun 12, 2022 via email

@dkm
Copy link
Member Author

dkm commented Jun 13, 2022

Woops of course should have used zu :)
I'll dig a bit to see if there's more to its absence than simply force of habit :)

@CohenArthur
Copy link
Member

I believe the z modifier was added for C99 so we should be good on the compatibility part?

The man page for printf states the following:

glibc 2.1 adds length modifiers hh, j, t, and z and conversion characters a and A.

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

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@tschwinge tschwinge mentioned this pull request Jun 13, 2022
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]>
@dkm dkm force-pushed the dkm/32b_format branch from 5eb6602 to 29f5749 Compare June 14, 2022 20:55
@dkm
Copy link
Member Author

dkm commented Jun 14, 2022

Reverted back to cast as %z spec not supported by GCC pretty printers

Copy link
Member

@CohenArthur CohenArthur left a 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

@dkm
Copy link
Member Author

dkm commented Jun 15, 2022

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...

Copy link
Collaborator

@dafaust dafaust left a 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

@CohenArthur
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 17, 2022

Build succeeded:

@bors bors bot merged commit d4a0780 into master Jun 17, 2022
@dkm
Copy link
Member Author

dkm commented Jun 17, 2022

Thanks for merging it, forgot about it sorry !

@dkm dkm deleted the dkm/32b_format branch June 17, 2022 11:29
@tschwinge tschwinge linked an issue Jun 25, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

32bit build warning
4 participants