aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/tutorial
diff options
context:
space:
mode:
authorIgor Zhukov <fsb4000@yandex.ru>2022-07-25 18:54:32 +0200
committerMark de Wever <koraq@xs4all.nl>2022-07-25 19:00:29 +0200
commitba49d39b20cc5358da28af2ac82bd336028780bc (patch)
tree41136f826a5527899bbf6d09956ce58d7ff55211 /llvm/docs/tutorial
parent8068751189af3099d9abef8953a9639d6798535c (diff)
downloadllvm-ba49d39b20cc5358da28af2ac82bd336028780bc.zip
llvm-ba49d39b20cc5358da28af2ac82bd336028780bc.tar.gz
llvm-ba49d39b20cc5358da28af2ac82bd336028780bc.tar.bz2
Use `<stdatomic.h>` with MSVC and C++
and use fallback only for C. It fixes the isssue with clang-cl: ``` #include <stdatomic.h> #include <stdbool.h> #ifdef __cplusplus #include <atomic> using namespace std; #endif int main() { atomic_bool b = true; } ``` ``` $ clang-cl /TC main.cpp # works ``` ``` $ clang-cl /TP /std:c++20 main.cpp stdatomic.h(70,6): error: conflicting types for 'atomic_thread_fence' void atomic_thread_fence(memory_order); ^ atomic(166,24): note: previous definition is here extern "C" inline void atomic_thread_fence(const memory_order _Order) noexcept { ... fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. ``` Many errors but `<stdatomic.h>` has many macros to built-in functions. ``` #define atomic_thread_fence(order) __c11_atomic_thread_fence(order) ``` and MSVC `<atomic>` has real functions. and the built-in functions are redefined. Reviewed By: #libc, aaron.ballman, Mordante Differential Revision: https://reviews.llvm.org/D130419
Diffstat (limited to 'llvm/docs/tutorial')
0 files changed, 0 insertions, 0 deletions