[libcxx-commits] [libcxx] [libc++] Protect the libc++ implementation from CUDA SDK's `__noinline__` macro (PR #73838)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 1 10:43:54 PST 2023


philnik777 wrote:

> @philnik777
> 
> > I'm pretty sure there are tests for this kind of thing.
> 
> I can't find anything using the pattern `::__attribute`. Could you confirm that it is indeed intentionally supported?

I wasn't talking about `__attribute__` specifically. There can be basically any string after the `::` that clang has to accept, so clang basically converts anything following the `::` to an identifier. e.g. clang also has to accept `[[whatever::volatile]]`. IOW it's intentional that clang accepts any keyword in C++11 attributes. You can see in `clang/test/Parser/cxx0x-attributes.cpp` that it's tested with a bunch of keywords and some very interesting syntax (lines 49 and 50 currently).

> > I think we can avoid the preprocessor problem by having the conditional as `#if !defined(_LIBCPP_CXX03_LANG) || _LICPP_CLANG_VER >= 1700`.
> 
> Yes, that indeed works.
> 
> > we can remove the macro entirely after the next release branch anyways.
> 
> Why? Because the next release will not support compilers that don't support the `[[__gnu__::__noinline__]]` syntax?

Yes


https://github.com/llvm/llvm-project/pull/73838


More information about the libcxx-commits mailing list