[PATCH] D53879: Make libc++'s versioning namespace customizable

Louis Dionne via Phabricator reviews at reviews.llvm.org
Tue Oct 30 14:22:27 PDT 2018


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: CMakeLists.txt:685
+if (NOT LIBCXX_ABI_NAMESPACE STREQUAL "")
+  if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*")
+    message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier.")
----------------
EricWF wrote:
> smeenai wrote:
> > ldionne wrote:
> > > EricWF wrote:
> > > > ldionne wrote:
> > > > > `__.+`? Or do we want to allow `__`?
> > > > In addition do we want `_Foo`. My thinking is we should probably allow users to foot-gun themselves as much as they want. 
> > > > 
> > > > We should probably document that we make no promises that we don't introduce names which conflict with their custom namespace name.
> > > Actually, that's interesting. Another possibility would be to only allow users to use names that we can promise we won't reuse. For example we could say `__x.+` is reserved for users, or something like that.
> > > 
> > > What we should really avoid is for someone to start using something like `__3`, which would conflict with something we want to use in the future. Even though it would be their problem in theory, in practice it might put pressure on us not to reuse the name (if it were an important vendor or something). Constraining what names they can use would clear this possibility out completely.
> > I would strongly prefer the allowed names to not be that restricted, since existing custom inline namespaces might not confirm to it (our doesn't). Allowing `__` followed by anything would work for us.
> I've added a warning in the documentation that it's the responsibility of the user to choose a name that won't cause conflict, and that we make no promises. I think that's sufficient. 
> 
> I've also weakened the error to a warning. 
> 
> 
I disagree that documentation is sufficient. I understand your point (in theory), but in practice the consequences for someone misusing our API can be large enough that we have to deal with it. So in practice, we need to harden a bit more against misuse, especially when it's that easy. Please at least do what @kristina suggests and make sure that people are not using `__[0-9]+`.


https://reviews.llvm.org/D53879





More information about the libcxx-commits mailing list