Skip to content

Conversation

@olabetskyi
Copy link
Collaborator

No description provided.

type = ValueType::Type::INT;
else
type = ValueType::Type::UNKNOWN_INT;
originalTypeName = typestr;
Copy link
Owner

Choose a reason for hiding this comment

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

originalTypeName is already assigned above.

originalTypeName = "size_t";

I'm not sure there might be a reason to remove "std::". if we have some code that uses originalTypeName ..

@sonarqubecloud
Copy link

else
type = ValueType::Type::UNKNOWN_INT;
sign = (podtype->sign == 'u') ? ValueType::UNSIGNED : ValueType::SIGNED;
if (originalTypeName.empty())
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 remember the exact context but can't typestr be something like "int". can it contain qualifiers and stars?

"[test.cpp:3]: (warning) %Lf in format string (no. 6) requires 'long double' but the argument type is 'signed int'.\n",
"void foo() { printf(\"%d %ld %u %lu %f %Lf\", bar().i, bar().i, bar().i, bar().i, bar().i, bar().i); }",
dinit(CheckOptions, $.portability = true));
ASSERT_EQUALS("[test.cpp:3]: (portability) %ld in format string (no. 2) requires 'long' but the argument type is 'int32_t {aka signed int}'.\n"
Copy link
Owner

Choose a reason for hiding this comment

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

hmm.. this looks very unfortunate. If the type is wrong i.e. long/int then I would prefer "warning". Or if we see that there is UB I would even prefer "error".
How difficult is it to keep writing warnings?

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