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 compilation error on RedHat when compiling with -Werror=sign-conversion #508

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

e-hndrks
Copy link
Contributor

The following compilation error was generated on RedHat platforms with older gcc compilers (e.g. gcc8.4) when compiling with the -Werror=sign-conversion:
"conversion to 'unsigned int' from 'int' may change the sign of the result"
This was caused by an implicit promotion to int32_t from the result of a logical AND operator on an unsigned char with a uint32_t as the mask. A subsequent logical OR on this result with an unsigned char shifted by four bits would cause the signed/unsigned conflict. By making sure all parameters are promoted to type int, we avoid this situation.

Copy link
Contributor

@eboasson eboasson left a comment

Choose a reason for hiding this comment

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

LGTM

@eboasson eboasson merged commit a76b617 into eclipse-cyclonedds:master Oct 1, 2024
17 of 20 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.

2 participants