File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ Improvements to Coverage Mapping
133133Bug Fixes in This Version
134134-------------------------
135135
136+ - Fixed the definition of ``ATOMIC_FLAG_INIT `` in ``<stdatomic.h> `` so it can
137+ be used in C++.
138+
136139Bug Fixes to Compiler Builtins
137140^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138141
Original file line number Diff line number Diff line change @@ -172,7 +172,11 @@ typedef _Atomic(uintmax_t) atomic_uintmax_t;
172172
173173typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
174174
175+ #ifdef __cplusplus
176+ #define ATOMIC_FLAG_INIT {false }
177+ #else
175178#define ATOMIC_FLAG_INIT { 0 }
179+ #endif
176180
177181/* These should be provided by the libc implementation. */
178182#ifdef __cplusplus
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -std=c11 -E %s | FileCheck %s
22// RUN: %clang_cc1 -std=c11 -fms-compatibility -E %s | FileCheck %s
3+ // RUN: %clang_cc1 -std=c11 %s -verify
4+ // RUN: %clang_cc1 -x c++ -std=c++11 %s -verify
5+ // expected-no-diagnostics
36#include <stdatomic.h>
47
58int bool_lock_free = ATOMIC_BOOL_LOCK_FREE ;
@@ -31,3 +34,5 @@ int llong_lock_free = ATOMIC_LLONG_LOCK_FREE;
3134
3235int pointer_lock_free = ATOMIC_POINTER_LOCK_FREE ;
3336// CHECK: pointer_lock_free = {{ *[012] *;}}
37+
38+ atomic_flag f = ATOMIC_FLAG_INIT ;
You can’t perform that action at this time.
0 commit comments