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

expand: C++ify proc macro decls generation #2791

Merged

Conversation

CohenArthur
Copy link
Member

This uses a stringstream instead of the older, better and more readable
sprintf version as the format overflow warning in current GCC is
overzealous and triggered on that code, despite the non-zero allocation.

Even using an unsigned value instead of a signed one for the size
variable caused issues, so switching to this is simpler.

gcc/rust/ChangeLog:

* expand/rust-proc-macro.cc: Use stringstream instead of sprintf.
* rust-system.h: Include <iomanip>.

This uses a stringstream instead of the older, better and more readable
`sprintf` version as the format overflow warning in current GCC is
overzealous and triggered on that code, despite the non-zero allocation.

Even using an unsigned value instead of a signed one for the `size`
variable caused issues, so switching to this is simpler.

gcc/rust/ChangeLog:

	* expand/rust-proc-macro.cc: Use stringstream instead of sprintf.
	* rust-system.h: Include <iomanip>.
@CohenArthur CohenArthur requested a review from P-E-P January 12, 2024 12:52
@CohenArthur
Copy link
Member Author

CohenArthur commented Jan 12, 2024

the code was too simple and readable anyway, this is much better, makes me feel like we're doing actual C++ /s

Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

LGTM.

@CohenArthur CohenArthur added this pull request to the merge queue Jan 15, 2024
Merged via the queue into Rust-GCC:master with commit 3fcd86e Jan 15, 2024
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants