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 #11685: FP floatConversionOverflow from dead code #6973

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

ludviggunne
Copy link
Contributor

No description provided.

lib/checktype.cpp Outdated Show resolved Hide resolved
@@ -495,6 +495,46 @@ class TestType : public TestFixture {
" return 1234.5;\n"
"}", settingsDefault);
ASSERT_EQUALS("[test.cpp:2]: (error) Undefined behaviour: float () to integer conversion overflow.\n", removeFloat(errout_str()));

const Settings settingsWithStdint = settingsBuilder().library("std.cfg").build();
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 loading std.cfg is required. Can you cast to "unsigned short" instead of uint16_t? That should save some cpu cycles.

lib/astutils.cpp Outdated
break;

if (parent->isBinaryOp()) {
bool left = tok == parent->astOperand1();
Copy link
Owner

Choose a reason for hiding this comment

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

nit: make left const.

@danmar danmar merged commit 4ad32de into danmar:main Nov 6, 2024
60 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.

3 participants