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

emulate chosen compiler in integer literal promotion #722

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

wrongnull
Copy link
Contributor

Closes #690

Comment on lines 1302 to 1305
implicitly_unsigned_literal_gcc
.msg = "integer constant is so large that it is unsigned"
.kind = .warning

Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we need to emulate differently worded diagnostics too.

@@ -8448,7 +8448,7 @@ fn fixedSizeInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok
const max_int = try Value.maxInt(res.ty, p.comp);
if (interned_val.compare(.lte, max_int, p.comp)) break;
} else {
res.ty = .{ .specifier = .ulong_long };
res.ty = .{ .specifier = if (p.comp.langopts.emulate == .gcc) .int128 else .ulong_long };
Copy link
Owner

Choose a reason for hiding this comment

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

This needs to check that the target supports __int128 with target_utils.hasFloat128.

Copy link

Choose a reason for hiding this comment

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

hasFloat128??

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry, target_utils.hasInt128. It looks like there is a helper for hasFloat128 in Compilation, you could add the same for hasInt128.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@wrongnull
Copy link
Contributor Author

@Vexu could you review changes now if you have a chance?

@Vexu Vexu merged commit 4f574a6 into Vexu:master Jul 30, 2024
3 checks passed
@Vexu
Copy link
Owner

Vexu commented Jul 30, 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 literal promotion rules should emulate chosen compiler
3 participants