Skip to content

Commit 2a9e09f

Browse files
authored
Merge pull request #5941 from martin-frbg/issue5937
Fix C/C++ atomics conflict in compilation of the cpp_thread_tests
2 parents c3de327 + 52f0572 commit 2a9e09f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ extern "C" {
8080
#endif
8181

8282
#ifndef ASSEMBLER
83-
#ifdef HAVE_C11
83+
#if defined(HAVE_C11) && !defined(__cplusplus)
8484
#if defined(C_GCC) && ( __GNUC__ < 7)
8585
// workaround for GCC bug 65467
8686
#ifndef _Atomic
@@ -447,7 +447,7 @@ please https://github.com/xianyi/OpenBLAS/issues/246
447447
#endif
448448

449449
#ifndef ASSEMBLER
450-
#ifdef HAVE_C11
450+
#if defined(HAVE_C11) && !defined(__cplusplus)
451451
#define BLAS_LOCK_DEFINED
452452
#endif
453453
#endif
@@ -579,7 +579,7 @@ static __inline void blas_lock(volatile BLASULONG *address){
579579
#define BLAS_LOCK_DEFINED
580580
#endif
581581

582-
#ifdef HAVE_C11
582+
#if defined(HAVE_C11) && !defined(__cplusplus)
583583
static __inline void blas_lock(volatile BLASULONG *address) {
584584
BLASULONG expected = 0;
585585
while (!atomic_compare_exchange_strong((volatile _Atomic BLASULONG *)address,
@@ -591,7 +591,7 @@ static __inline void blas_lock(volatile BLASULONG *address) {
591591
#endif
592592

593593
static __inline void blas_unlock(volatile BLASULONG *address){
594-
#ifdef HAVE_C11
594+
#if defined(HAVE_C11) && !defined(__cplusplus)
595595
atomic_store((volatile _Atomic BLASULONG *)address, (BLASULONG)0);
596596
#else
597597
MB;

0 commit comments

Comments
 (0)