-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[metacling] remove redundant 'using namespace std' since std is autoinjected later in TClingUtils #17175
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
base: master
Are you sure you want to change the base?
Conversation
Test Results 18 files 18 suites 3d 17h 22m 12s ⏱️ For more details on these failures, see this check. Results for commit b848e4c. ♻️ This comment has been updated with latest results. |
pcanal
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.
We should clarify here where the/an other injection of the using namespace std is done. It may (or may not) be that this injection is the logical place to keep (and remove the other instead).
|
I think/believe in TClingUtils it's not an injection per se of the whole namespace, but rather that it checks if a class is defined within std. Changing it here is straightforward, in the other place I believe much more complicated |
|
Indeed. The injection per name is the right direction. Please update the commit log to point to where in TClingUtils this is happening. |
hahnjo
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.
I believe this is far more complicated than just removing the using namespace std, see this PR by Axel from two years ago: #11027
This PR is not aiming at any change in behavior (what Axel tried). It's just "cleaning up the code",. Nothing will change. You will still get the (for some) annoying behavior of having everything within std there in the interpreter. Here in this PR, we just remove a redundant statement. Note that all tests pass, and the interpreter works as before, which means that this basically like a no-op commit. |
The TClingUtils class already takes care of finding if it's a class from the STD, it's irrelevant if you called using namespace std or not. See e.g. https://github.com/root-project/root/blob/0ca04325af4ccbb4c7ad553b63679c902096feaa/core/clingutils/src/TClingUtils.cxx#L4453 On the other hand, rootcling has its own using namespace std statement, so this change does not affect rootcling either. The injection of std on a case-by-case basis based on the name is already taken care of in, so this Pre-include statement here is unnecessary or functionally redundant. In other words, this just a code cleanup that introduces no functional change at all. interpreter still works without needing to prepend std::
|
The explanation is not correct, |
Humm ... Did we test this PR with |
See https://github.com/root-project/root/actions/runs/12164244293/job/33925453332?pr=17175 |
Ok, I wasn't 100% precise: with |
I understand. Feel free to close this PR in that case. I just thought, if at some point, someone tries to restart with #11027, there was one line less to worry about. Speaking about 11027 and potential ways to slowly going away from global std, from my point of view, it would be nice to have something equivalent to this config variable: So, one could have this interpreter behavior: In ROOT 6.42 one could set the default to 1, and in ROOT 9 set the default to 0 ;) This could be independent on dictionary generation, I guess, that could stay as before with full namespace std statement. |
This Pull request:
Changes or fixes:
according to my (limited) tests, interpreter still works without needing to prepend std:: on any class, so this doesn't change behavior
Checklist: