Skip to content

Commit 1ad7de9

Browse files
committed
Headers: exclude #include_next <stdatomic.h> on MSVC
The 14.31.30818 toolset has the following in the `stdatomic.h`: ~~~ #ifndef __cplusplus #error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release. #endif ~~~ This results in clang failing to build existing code which relied on `stdatomic.h` in C mode on Windows. Simply fallback to the clang header until that header is available as a complete implementation.
1 parent 187d997 commit 1ad7de9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Headers/stdatomic.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
1414
* example, already has a Clang-compatible stdatomic.h header.
15+
*
16+
* Exclude the MSVC path as well as the MSVC header as of the 14.31.30818
17+
* explicitly disallows `stdatomic.h` in the C mode via an `#error`. Fallback
18+
* to the clang resource header until that is fully supported.
1519
*/
16-
#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
20+
#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) && !defined(_MSC_VER)
1721
# include_next <stdatomic.h>
1822
#else
1923

0 commit comments

Comments
 (0)