-
Notifications
You must be signed in to change notification settings - Fork 787
[ESIMD] Fix leakage of detail namespace #3673
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
This patch removes `using namespace sycl::INTEL::gpu::detail;` which leaks into the global namespace.
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 patch removes using namespace sycl::INTEL::gpu::detail; from esimd.hpp header file, which leaks names into the global namespace.
I'm not sure what problem this patch solves. Please elaborate
The expression |
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.
LGTM!
One question I have is: did you search to see if there are other using namespace
directives as well?
I don't think this is the case. namespace a {
class A{};
}
namespace b {
using namespace a;
class B : public A{};
}
A f_in_global_namespace() {
return A{};
} |
I can see the problem now. For symbols to be leaked it is not enough to have this removed namespace a {
class A{};
}
namespace b {
using namespace a;
class B : public A{};
}
using namespace b; // <----- second required component of the leak.
A f_in_global_namespace() {
return A{};
} |
I saw these:
The last three do it from within |
Yes, I think it is a general rule that |
+1 (outside of situations in which it cannot leak, such as within a function body, as may be needed when considering ADL). |
This patch removes
using namespace sycl::INTEL::gpu::detail;
fromesimd.hpp
header file, which leaks names into the global namespace.