-
Notifications
You must be signed in to change notification settings - Fork 12.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
type trait builtins __remove_cv[ref] are used unconditionally #99464
Comments
What exactly is your point/question/bug report?
That's simply not true. Lots of type traits don't have guards. Only builtin traits which aren't supported by all supported compilers have guards. |
I'd like to have usages of builtin type traits guarded. The motivation for this is the homegrown language engine which works pretty well with libc++ (and any C++ code in general) but doesn't support these type traits yet. |
I'm not sure what exactly you're referring to, but we can't support arbitrary C++ parsers. From our side the patch simply removed dead code. You can ask for official support for your tool, but without pre-commit testing that most likely won't happen. |
Sorry, but I don't understand what's the problem with providing the fallback for parsers that don't support the builtin, how it was before the commit 5535716. This is also how a lot of type traits are implemented right now: |
There are also lots of traits which don't check the flag. We don't support any compilers where |
It contradicts the very first statement phrase from the official documentation: "Libc++ aims to support common compilers that implement the C++11 Standard." |
And the second sentence states "In order to strike a good balance between stability for users and maintenance cost, testing coverage and development velocity, libc++ drops support for older compilers as newer ones are released.". Don't cherry-pick your quotes. |
Most importantly, we do in fact support common compilers, but we don't support arbitrary ones. We support GCC, Clang and most Clang-based compilers (AppleClang, IBM's compiler, etc). But no, we don't support arbitrary compilers or arbitrarily old versions of the above compilers because that would not be viable maintenance-wise. We also don't aim to support arbitrary homegrown language engines. I don't mean this in a hostile way -- it would be great for your tool to work with libc++, however we unfortunately can't start taking into account these kinds of niche requests for support because that would never end. Libc++ is used extremely widely and you'd be surprised what kind of stuff people want to do with it, and what kind of requests we get. In order for the project to stay relevant, it has to stay focused, and that often means saying no. |
Hey there. For the context: I'm @AndreyG's colleague.
Thanks for pointing out; it makes total sense. I fully understand that supporting custom/old compilers doesn't fit in the libc++ development process (and there's no way to check compatibility with custom tools). However, may I ask you for the temporary exclusion here and providing fallback implementation for 3-6 more months until tooling is fully ready for those changes? Specifically, I'm talking about language support in CLion IDE / ReSharper C++ / Rider (three JetBrains products). We are ready with internal implementation, but delivering it to end users might take some time (you know, releasing processes). I'm asking because we already have reports from users who tried fresh libc++ in their projects (i.e. chromium) and got a lot of red code in their editor even with basic stuff: This was indeed our fault that we didn't provide implementation of those type traits in time, but that approach worked fine recently: usually, type traits were guarded, and we had some time to adapt. Now we realize that we should not rely on guards anymore and will support new builtin traits as fast as possible. I really hope that suggested changes won't affect the development process of libc++ too much. I'm ready to create corresponding PR, if needed. Thanks! |
@Smertig If you want to revert IMO we should have some sort of test coverage for your tools. That could be as simple as running the parser over all headers and making sure it works. I realize that that's a request which won't be fulfilled in a few days, so I'd be happy with a promise that you'll work with us to set something up. That gives us visibility into any problems your parser has with our code, and you get very early reports when anything breaks. |
@philnik777 I would be fine with reverting that commit from |
@ldionne sure, we can do that. I'd be against reverting on trunk though. Given that chromium was mentioned it seemed to me like reverting trunk was also requested. |
@nico Can you chime in? FWIW I'd be against reverting on |
That's a good point. Unfortunately, I don't have a good solution that can be added to libc++'s CI right now, but I'll investigate possible options taking into account all the licensing factors. As a first step, we'll try to run our tooling over
It would be really nice, thank you! I also understand that reverting something from |
…e_cvref (llvm#81386)" This reverts commit 5535716. This is only being reverted from the LLVM 19 branch as a convenience to avoid breaking some IDEs which were not ready for that change. Fixes llvm#99464
…e_cvref (llvm#81386)" This reverts commit 5535716. This is only being reverted from the LLVM 19 branch as a convenience to avoid breaking some IDEs which were not ready for that change. Fixes llvm#99464
After the commit 5535716 by @philnik777 the usages of builtin type traits
__remove_cv
/__remove_cvref
are not guarded by#if __has_builtin(__remove_cv[ref])
:llvm-project/libcxx/include/__type_traits/remove_cv.h
Line 22 in da0c8b2
llvm-project/libcxx/include/__type_traits/remove_cvref.h
Line 42 in da0c8b2
Note that even the remaining comment is wrong now
#endif // __has_builtin(__remove_cv)
.llvm-project/libcxx/include/__type_traits/remove_cv.h
Line 31 in da0c8b2
Also note that all other type traits builtins are used only after the check, for instance
__add_pointer
here:llvm-project/libcxx/include/__type_traits/add_pointer.h
Line 23 in da0c8b2
The text was updated successfully, but these errors were encountered: