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

Work around -Werror=type-limits under gcc 10.2 #8092

Merged
merged 2 commits into from
Nov 26, 2020

Conversation

jorgbrown
Copy link
Contributor

This is an error when tag is greater than 128 under gcc 10.2: if (tag < 128) return *ptr == tag;
It's an error even though the comparison occurs in a branch of code we know won't be taken. See https://godbolt.org/z/1eaP86
This works around the problem by clipping tag to within bounds.

This is an error when tag is greater than 128 under gcc 10.2:   if (tag < 128) return *ptr == tag;
It's an error even though the comparison occurs in a branch of code we know won't be taken.  See https://godbolt.org/z/1eaP86
This works around the problem by clipping tag to within bounds.
@google-cla google-cla bot added the cla: yes label Nov 25, 2020
@dlj-NaN dlj-NaN self-assigned this Nov 26, 2020
src/google/protobuf/parse_context.h Outdated Show resolved Hide resolved
"tag % 128" becomes "static_cast<char>(tag)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants