[clang] OpenBSD does not support C11 atomics or threads.

This commit is contained in:
Brad Smith
2021-09-03 21:11:32 -04:00
parent c7f50a445e
commit d8cd780631
2 changed files with 15 additions and 0 deletions

View File

@@ -462,6 +462,11 @@ protected:
Builder.defineMacro("__FLOAT128__");
}
if (Opts.C11) {
Builder.defineMacro("__STDC_NO_ATOMICS__");
Builder.defineMacro("__STDC_NO_THREADS__");
}
public:
OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {

View File

@@ -1464,6 +1464,16 @@
// OPENBSD:#define __WCHAR_TYPE__ int
// OPENBSD:#define __WINT_TYPE__ int
//
// RUN: %clang_cc1 -x c -std=c11 -E -dM -ffreestanding -triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD-STDC %s
// RUN: %clang_cc1 -x c -std=gnu11 -E -dM -ffreestanding -triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD-STDC %s
// RUN: %clang_cc1 -x c -std=c17 -E -dM -ffreestanding -triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD-STDC %s
// OPENBSD-STDC:#define __STDC_NO_ATOMICS__ 1
// OPENBSD-STDC:#define __STDC_NO_THREADS__ 1
//
// RUN: %clang_cc1 -x c -std=c99 -E -dM -ffreestanding -triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines -check-prefix OPENBSD-STDC-N %s
// OPENBSD-STDC-N-NOT:#define __STDC_NO_ATOMICS__ 1
// OPENBSD-STDC-N-NOT:#define __STDC_NO_THREADS__ 1
//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=xcore-none-none < /dev/null | FileCheck -match-full-lines -check-prefix XCORE %s
// XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// XCORE:#define __LITTLE_ENDIAN__ 1