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

More parsing tests for literals with leading minus #99

Closed
wants to merge 2 commits into from

Conversation

dneto0
Copy link
Collaborator

@dneto0 dneto0 commented Feb 8, 2016

Also checks some hex literal cases.

This addresses part of
#45
by removing the parseNumber case for "-0" on unsigned
integers. We don't care about that platform difference
at the level of std::istringstream, since we reject it
at a higher parsing level.

Also checks some hex literal cases.

This addresses part of
KhronosGroup#45
by removing the parseNumber case for "-0" on unsigned
integers.  We don't care about that platform difference
at the level of std::istringstream, since we reject it
at a higher parsing level.

// Valid values.
EXPECT_EQ(SPV_SUCCESS, context.parseNumber("0", ec, &u32, ""));
EXPECT_EQ(0, u32);
Copy link

Choose a reason for hiding this comment

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

Should be 0u -- see Travis failures.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in next commit

MakeInstruction(SpvOpConstant, {1, 2, 0})})},
{"OpTypeInt 16 1", "-32768",
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}),
MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32768)})})},
Copy link

Choose a reason for hiding this comment

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

"Convert arithmetic types using brace initialization."

https://google.github.io/styleguide/cppguide.html#Casting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The style guide has been changing in this regard. That's new advice. We never did go back and change all our existing uint32_t( .. ) to static_cast. I'll use the brace initialization in future.

@dekimir
Copy link

dekimir commented Feb 8, 2016

+2 despite nits.

@dneto0
Copy link
Collaborator Author

dneto0 commented Feb 8, 2016

Squashed and pushed into master as feda995

@dneto0 dneto0 closed this Feb 8, 2016
@dneto0 dneto0 deleted the leading-minus branch February 13, 2016 01:18
rjodinchr pushed a commit to rjodinchr/SPIRV-Tools that referenced this pull request Jun 22, 2022
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.

None yet

2 participants