-
Notifications
You must be signed in to change notification settings - Fork 483
[CleanUp] Add fully qualified names for std::string and std::map #14524
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
Conversation
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
davidrohr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct to me, and indeed one should not have using statements in headers in the global namespace.
Please ignore the CI failure about code formatting, this is just because you touched files that are not formatted correctly. We can just force-merge it ignorning the CI errors.
Why did you mark the PR draft? In principle we should start the CI on it and check if it suceeds.
Oh, that was just to play it safe. And also to maybe avoid the mass ping if there was something wrong with formatting and other smaller things. I'll mark it as ready. |
|
@mrtineide : CI looks good, could you please fix the merge conflict and update the PR. Then we can merge it. |
e01eaba to
284d96c
Compare
284d96c to
a39666f
Compare
The header TJAlienCredentials.h polluted the global namespace, included usually with CCDB or something related. Many source files in O2 took advantage of this. This commit prepares for the removal of the polluted namespace. The libraries/repo with TJAlienCredentials is JAliEn-ROOT and libjalieno2. The problem was first noticed by @vkucera.
a39666f to
c025018
Compare
|
Thank you! |
|
Thanks a lot, @mrtineide ! |
The header TJAlienCredentials.h polluted the global namespace, included usually with CCDB or something related. See AliceO2Group/AliceO2#14524 This commit prepares for the removal of the polluted namespace. The libraries/repo with TJAlienCredentials is JAliEn-ROOT and libjalieno2. The problem was first noticed by @vkucera.
The header TJAlienCredentials.h polluted the global namespace, included usually with CCDB or something related. See AliceO2Group/AliceO2#14524 for more background. This commit prepares for the removal of the polluted namespace. The libraries/repo with TJAlienCredentials is JAliEn-ROOT and libjalieno2. The problem was first noticed by @vkucera.
* Add fully qualified names for std::string and std::map The header TJAlienCredentials.h polluted the global namespace, included usually with CCDB or something related. See AliceO2Group/AliceO2#14524 for more background. This commit prepares for the removal of the polluted namespace. The libraries/repo with TJAlienCredentials is JAliEn-ROOT and libjalieno2. The problem was first noticed by @vkucera. * fix clang-format --------- Co-authored-by: Piotr Konopka <piotr.jan.konopka@cern.ch>
For more details about the change look at: GitHub: AliceO2Group/AliceO2#14524 GitLab: https://gitlab.cern.ch/jalien/jalien-root/-/merge_requests/88
For more details about the change look at: GitHub: AliceO2Group/AliceO2#14524 GitLab: https://gitlab.cern.ch/jalien/libjalieno2/-/merge_requests/3
When working on AliceO2Group#14524 the code that needed to be changed came most likely from the README.md and its code example. So with this change now any future copy-paste will also have std::.
When working on #14524 the code that needed to be changed came most likely from the README.md and its code example. So with this change now any future copy-paste will also have std::.
* Bump JAliEn-ROOT to tag 0.7.15 For more details about the change look at: GitHub: AliceO2Group/AliceO2#14524 GitLab: https://gitlab.cern.ch/jalien/jalien-root/-/merge_requests/88 * Bump libjalienO2 to tag 0.1.5 For more details about the change look at: GitHub: AliceO2Group/AliceO2#14524 GitLab: https://gitlab.cern.ch/jalien/libjalieno2/-/merge_requests/3
When working on AliceO2Group#14524 the code that needed to be changed came most likely from the README.md and its code example. So with this change now any future copy-paste will also have std::.
Namespace cleanup - Change in other libraries will affect O2
Story of what happened
I was contacted by @costing, who relayed a report from @vkucera regarding problematic headers. It was discovered while running
clang-tidyonO2Physics. The issue was that while runningcland-tidyit would include the headerTJAlienCredentials.hfrom theJAlien-ROOTorlibjalienO2libraries instead of#include <string>.Specifically, the header contained the following lines:
These
usingdeclarations in a header file pollute the global namespace for every file that uses them. A common place where this was spread was throughCCDBApi.h, which includesTJAlienCredentials.h, thereby spreading theusing std::stringdeclaration across many parts that uses CCDB API.I am new to C++ so I had to find some sources that confirmed why the change should be considered:
The proposed change in the other repo's:
In external repos: Removed
using std::stringandusing std::mapfromTJAlienCredentials.hWhat this PR does
I updated all affected files in O2 to explicitly use
std::where needed for compilation to complete.That is, this compilation command completed:
Some smaller potential issues
std::in places where it wasn’t strictly necessary due tousing std::string;declarations in the same.cxxfiles.A bit about me 🧑💻
Please let me know if anything is not how it should be and I'll fix it. (I do not know if I got the o2codechecker to run properly)