-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use anonymous namespaces to avoid duplicate symbols #11066
Conversation
A new Pull Request was created by @wmtan for CMSSW_7_6_X. Use anonymous namespaces to avoid duplicate symbols It involves the following packages: RecoEgamma/EgammaTools @cmsbuild, @cvuosalo, @slava77 can you please review it and eventually sign? Thanks. |
please test |
The tests are being triggered in jenkins. |
@wmtan we will need it for 75X and 74X |
@slava77 OK, I will do PRs for this in 7_5_X and 7_4_X. |
This pull request is fully signed and it will be integrated in one of the next CMSSW_7_6_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @Degano, @smuzaffar |
On 9/1/15 5:06 PM, wmtan wrote:
Thank you, Bill For 74X, please check if it merges against #10649
|
+1 |
Use anonymous namespaces to avoid duplicate symbols
Bug fix. Totally technical.
Can be backported to 7_5_X if requested.
In RecoEgamma/EgammaTools/plugins, there are free function templates in different files that have the same signature. These are violations of the ODR (one definition rule).
The reason this problem has not yet been seen before is that the function templates in question are declared "inline". However, "inline" is only a suggestion to the compiler. When compiled in debug mode (-O0), in-lining was apparently turned off. This did not cause a link error, as function templates are not instantiated until run time. However, it caused the wrong function to be called in several cases, causing relvals 4.53, 135.4, and 1330.0 to fail.
The fix is to put the templates inside an anonymous namespace, so each template is not seen outside the compilation unit. This fixes the failing relvals.