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
Silence build-time warning coming from scope.h #18948
Silence build-time warning coming from scope.h #18948
Conversation
Your change effectively reverts d0f83c3. The identity check:
is intended to shortcut the comparison and I believe our use here is valid, since it's combined with the string comparison. But I think the warning is in general a good warning. Instead of removing the comparison (or suppressing the warning globally) we could suppress the warning for this case:
|
Thanks for the review. I tested it with each of gcc and g++ as C-compiler and the warning was suppressed. Can you explain how the use of a macro with 'CLANG' in its name covers those two cases as well? Branch updated. |
It's not documented, but I suspect gcc recognizes the pragma that macro generates - clang is documented to recognize the GCC version of the pragma. If both compilers are warning on this code then using the gcc version might be better, since clang is documented to recognize the gcc pragma. |
I updated the branch/pull request as follows:
I then built with each of the 3 compilers in turn. In each case, the warnings coming from scope.h were not generated. Please review. |
The final result looks reasonable, but please squash and force push the PR branch. |
Per discussion with TonyC, use of the 'GCC' versions of two macros here is appropriate because that version is documented to handle CLANG as well. Using these macros preserves an optimization added in d0f83c3 in 2009. PR GH 18948 for issue GH 17015.
8c417c6
to
f7b3322
Compare
In our ticket tracking build-time warnings generated during
make
when usingclang
(especially versions 9, 10 and 11) to buildperl
, #17015, the last remaining such warning looked like this:Analysis of the
make
output showed that the source of the problem lay inscope.h
. This pull request simplifies some code in that file and silences that build-time warning.(Unfortunately, it does not mean we've achieved warnings-free building with clang9 or clang10. Since that time a build-time warning has crept into
cpan/Scalar-List-Utils/ListUtil.xs
, for which I have filed a bug ticket upstream.)(Also, we still have to face the problem of many thousands of build-time warnings being generated when we configure with clang12.)
Thank you very much.
Jim Keenan