<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57710>57710</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
stdatomic.h is not working in C mode (15.0.0)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ngg
</td>
</tr>
</table>
<pre>
libc++ 15.0.0 added the new `stdatomic.h` file: https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/stdatomic.h
This 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#L25
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:
- https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/complex.h#L32
- https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/errno.h#L31
- https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/libcxx/include/stddef.h#L45
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VEtzmzAQ_jVw0ZgBAX4cODgkaTPjtJk-zh4JLaBWSB5J1Pa_7wrsxJceekhmBOjFfo9diRtxrpTkTUTvsJGsTNIkJUwIEMT3QDQcSbRMnRfMm0E2SY8j0koFUb4lvfcHh52IPmLrpO9HnjRmwIFSf66fxcGaX9B4HHJl-GXW2G4xw4UJpHA6YUfqRo0CsHcLmd5H6XZ-_-ilm_BJzxxhhENrLJB6FkBzgvAH5iWXSvozjgSQYy-bnrjejEqQCwIxKM_-QxvulYcDWgDKwRH3fahamu8ozRc7mmfJrfSfGqX6UTMP6hzRGhOEXmDTxhNvZdchUYFqQaNKUpPBhNg1etSw0cGUUJS43z3d1S8v-_rr88vT7uHbvt5tv3za322_P9wHBzCi0epMHPgQJ_yxb4xuZRdWj6gbZ9m0gFxlK6AluOOgRheesMlCJ41-b9NeaQXHylurno3zlwz3wAR-QlodOsD8tRA4Foaxv6XuSGvNgH5NxYJVdQSlSDDsKnFG3Gs4-aBOSItc5R8MOGqkIKRHtUyhZ8bO_s-m3VpyyROaJTWIhHzGZBGGjzPDGxM4seGATINjk5LFuzoYDouC01x0Of0ISLBWmwtg9hGAeLTQ9BmxKGOosuUyT8v1ushiUeVik29Y7KVXUN2cwmu-rol5PVAkousr3CYerar-m7x0bsQU08dytcrSuK_yhq2WzboQ65JtoG0LoDRrypJlRcN4ymPFOF5FVVTiJUfDnTyFwH5U3seyoiml6SbL03WxolnCOSvoqsxY0zLWNkVUpDAwqZLAI0G_YltNlPjYOVxU0nn3tsick50GmOAwPht9b2yluy6eYKuJ9l81KwUL">