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 -Wpotentially-evaluated-expression warnings #9355
Conversation
Clang warns if expression inside typeid() or sizeof() could create unwanted side effects. Two warnings were in this package. Full message: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression] I couldn't find code in CMSSW using getAs<>(). They are only tested in private tests (different package), but it's not executed in CMSSW testsuite. In addition to that test input file is not present. The pieces generating message were tested manually in a standalone testcase. Tested on GCC (4.9.1) and Clang (pre-3.6). If it's impossible to demangle symbols at run-time, message will be: You can't convert a 'N3edm3PtrI10Candidate2EE' to a '9Candidate' Note: you can use 'c++filt -t' command to convert the above in human readable types. This is a light update to old one. Also mention '-t' option, as c++filt does not demangle type symbols by default. If we can demangle symbols at run-time, message will be: You can't convert a 'Candidate2' to a 'Candidate' Notice that instead of printing 'edm::Ptr<Candidate>' it talks about actual type in 'edm::Ptr<>'. Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
A new Pull Request was created by @davidlt for CMSSW_7_5_X. Fix -Wpotentially-evaluated-expression warnings It involves the following packages: DataFormats/PatCandidates @cmsbuild, @vadler, @monttj can you please review it and eventually sign? Thanks. |
Again only users of this in CMSSW are:
They are private and not executed in CMSSW test suite. For testing of message I was using this standalone test (for the record):
|
+1 |
This pull request is fully signed and it will be integrated in one of the next CMSSW_7_5_X IBs unless changes (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @Degano, @smuzaffar |
+1 |
Fix -Wpotentially-evaluated-expression warnings
Clang warns if expression inside
typeid()
orsizeof()
could createunwanted side effects.
Two warnings were in this package. Full message:
I couldn't find code in CMSSW using
getAs<>()
. They are only tested inprivate tests (different package), but it's not executed in CMSSW
testsuite. In addition to that test input file is not present.
The pieces generating message were tested manually in a standalone
testcase.
Tested on GCC (4.9.1) and Clang (pre-3.6).
If it's impossible to demangle symbols at run-time, message will be:
This is a light update to old one. Also mention
-t
option, asc++filt
does not demangle type symbols by default.
If we can demangle symbols at run-time, message will be:
Notice that instead of printing
edm::Ptr<Candidate>
it talks aboutactual type in
edm::Ptr<>
.Signed-off-by: David Abdurachmanov David.Abdurachmanov@cern.ch