Most other header files that should be working from C code as well use #include_next directives unconditionally or when __cplusplus is not defined. Here are some working examples:
See the discussion in https://reviews.llvm.org/D131435. Unfortunately I've been on leave and haven't had time to address @ldionne's suggestions. I'd be happy for you or someone else to pick up that work if you need it.
libc++ 15.0.0 added the new
stdatomic.h
file: https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/stdatomic.hThis file has a before C++23 compatibility code which should include other
stdatomic.h
file shipped elsewhere: https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/stdatomic.h#L223-L231.Unfortunately, this is not triggered when in C mode, because the
_LIBCPP_COMPILER_CLANG_BASED
is only set in__config
within an#ifdef __cplusplus
region: https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/__config#L25Most other header files that should be working from C code as well use
#include_next
directives unconditionally or when__cplusplus
is not defined. Here are some working examples: