lkail created this revision. lkail added reviewers: PowerPC, hubert.reinterpretcast, jsji, cebowleratibm, Jake-Egan. Herald added subscribers: jfb, kbarton, nemanjai. lkail requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
In https://reviews.llvm.org/D103707, `__STDC_NO_ATOMICS__` is predefined to indicate clang on AIX doesn't support `_Atomic` and not shipped with `stdatomic.h` yet. Actually `_Atomic` is already supported. For `stdatomic.h`, clang has implemented one in `clang/lib/Headers/stdatomic.h`. The remaining problem is void atomic_thread_fence(memory_order); void atomic_signal_fence(memory_order); _Bool atomic_flag_test_and_set(volatile atomic_flag *); _Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order); are defined as macros and don't have external linkage required by C11 standard, since current libc of AIX doesn't have them now. So is it worthwhile to violate the standard a bit, but make c11's atomics functionality available to users? If not, we may have to wait for upgrading of AIX's libc to define above routines. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D109139 Files: clang/lib/Basic/Targets/OSTargets.h clang/test/Preprocessor/init-ppc.c Index: clang/test/Preprocessor/init-ppc.c =================================================================== --- clang/test/Preprocessor/init-ppc.c +++ clang/test/Preprocessor/init-ppc.c @@ -755,11 +755,9 @@ // RUN: %clang_cc1 -x c -std=c11 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s // RUN: %clang_cc1 -x c -std=gnu11 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s // RUN: %clang_cc1 -x c -std=c17 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s -// PPC-AIX-STDC:#define __STDC_NO_ATOMICS__ 1 // PPC-AIX-STDC:#define __STDC_NO_THREADS__ 1 // RUN: %clang_cc1 -x c -std=c99 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC-N %s -// PPC-AIX-STDC-N-NOT:#define __STDC_NO_ATOMICS__ 1 // PPC-AIX-STDC-N-NOT:#define __STDC_NO_THREADS__ 1 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -mlong-double-64 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-LD64 %s Index: clang/lib/Basic/Targets/OSTargets.h =================================================================== --- clang/lib/Basic/Targets/OSTargets.h +++ clang/lib/Basic/Targets/OSTargets.h @@ -679,10 +679,8 @@ Builder.defineMacro("__TOS_AIX__"); Builder.defineMacro("__HOS_AIX__"); - if (Opts.C11) { - Builder.defineMacro("__STDC_NO_ATOMICS__"); + if (Opts.C11) Builder.defineMacro("__STDC_NO_THREADS__"); - } if (Opts.EnableAIXExtendedAltivecABI) Builder.defineMacro("__EXTABI__");
Index: clang/test/Preprocessor/init-ppc.c =================================================================== --- clang/test/Preprocessor/init-ppc.c +++ clang/test/Preprocessor/init-ppc.c @@ -755,11 +755,9 @@ // RUN: %clang_cc1 -x c -std=c11 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s // RUN: %clang_cc1 -x c -std=gnu11 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s // RUN: %clang_cc1 -x c -std=c17 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC %s -// PPC-AIX-STDC:#define __STDC_NO_ATOMICS__ 1 // PPC-AIX-STDC:#define __STDC_NO_THREADS__ 1 // RUN: %clang_cc1 -x c -std=c99 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-STDC-N %s -// PPC-AIX-STDC-N-NOT:#define __STDC_NO_ATOMICS__ 1 // PPC-AIX-STDC-N-NOT:#define __STDC_NO_THREADS__ 1 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -mlong-double-64 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX-LD64 %s Index: clang/lib/Basic/Targets/OSTargets.h =================================================================== --- clang/lib/Basic/Targets/OSTargets.h +++ clang/lib/Basic/Targets/OSTargets.h @@ -679,10 +679,8 @@ Builder.defineMacro("__TOS_AIX__"); Builder.defineMacro("__HOS_AIX__"); - if (Opts.C11) { - Builder.defineMacro("__STDC_NO_ATOMICS__"); + if (Opts.C11) Builder.defineMacro("__STDC_NO_THREADS__"); - } if (Opts.EnableAIXExtendedAltivecABI) Builder.defineMacro("__EXTABI__");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits