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

Widen integer literal to unsigned when required #516

Merged
merged 5 commits into from
Nov 26, 2024

Conversation

serenity4
Copy link
Contributor

Fixes #515.

This include an additional fix with txt_no_sfx = replace(txt_no_sfx, r"^0X" => "0x") to also support integer constants formatted as 0X012345678, which otherwise throw an error when executed.

Copy link
Member

@JamesWrigley JamesWrigley left a comment

Choose a reason for hiding this comment

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

Would be nice to make a changelog entry too :)

src/generator/macro.jl Outdated Show resolved Hide resolved
@serenity4
Copy link
Contributor Author

Nightly failures seem unrelated, locally the fix handles hexadecimal and decimal literal integers correctly (using Clong by default and only wrap in Culong when the value doesn't fit).

@JamesWrigley
Copy link
Member

Sorry forgot to mention, could we add a test too? I would recommend adding a header file in https://github.com/JuliaInterop/Clang.jl/tree/master/test/include and then using it in https://github.com/JuliaInterop/Clang.jl/blob/master/test/generators.jl.

@serenity4
Copy link
Contributor Author

serenity4 commented Nov 25, 2024

Sure, thanks for the pointer! Should be good now. There is a test failure on x64, looking at it now.

@serenity4 serenity4 force-pushed the master branch 2 times, most recently from 7f73ecd to 6ed0e00 Compare November 25, 2024 09:37
@serenity4
Copy link
Contributor Author

All good :)

@JamesWrigley
Copy link
Member

Unofficial LGTM!

@Gnimuc Gnimuc merged commit ce61d3e into JuliaInterop:master Nov 26, 2024
6 of 11 checks passed
@Gnimuc
Copy link
Member

Gnimuc commented Nov 26, 2024

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

Successfully merging this pull request may close these issues.

Integer literals incorrectly treated as Clong
3 participants