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

[Android][Clang 3.2] Lots of "shift-op-parentheses" warnings #76

Closed
ghost opened this issue Apr 28, 2013 · 3 comments
Closed

[Android][Clang 3.2] Lots of "shift-op-parentheses" warnings #76

ghost opened this issue Apr 28, 2013 · 3 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 28, 2013

One particular line in GLM causes insane amounts of "shift-op-parentheses" warnings during compilation with Android NDK r8e/Clang 3.2:

glm-0.9.4.0/glm/core/func_integer.inl:106:95: warning: operator '<<' has lower precedence than '-'; '-' will be evaluated first [-Wshift-op-parentheses]
                        return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y));
                                                               ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
glm-0.9.4.0/glm/core/func_integer.inl:106:95: note: place parentheses around the '-' expression to silence this warning
                        return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y));

Changing that line to this helps:

return genUType(detail::highp_int_t(1) << (detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y)));

I guess that normally that wouldn't be a big deal but I know of a few projects that use Clang solely for static code analysis and such flood of warnings certainly doesn't help.

@ghost
Copy link
Author

ghost commented Apr 28, 2013

I'm sorry, I didn't check the latest version from Git repo - this is fixed already. Please close that bug, sorry for your trouble.

@ghost ghost assigned Groovounet Apr 29, 2013
@Heorhiy
Copy link

Heorhiy commented Oct 8, 2013

I use latest version but still have lots of warnings
/glm/core/func_integer.inl:54:65: warning: shift count >= width of type [-Wshift-count-overflow]
genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32)));

Apple LLVM version 5.0 (clang-500.2.75) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0

@Groovounet
Copy link
Member

This warning was actually showing implementation bugs.

This is fixed in GLM 0.9.5 branch.

Thanks for contributing!
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants