forked from OSchip/llvm-project
[SystemZ][z/OS] Set default wchar_t type for zOS
Set the default wchar_t type on z/OS, and unsigned as the default. Reviewed By: hubert.reinterpretcast, fanbo-meng Differential Revision: https://reviews.llvm.org/D87624
This commit is contained in:
parent
e2703c021d
commit
0fb97fd6a4
|
@ -776,7 +776,9 @@ protected:
|
|||
|
||||
public:
|
||||
ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||
: OSTargetInfo<Target>(Triple, Opts) {}
|
||||
: OSTargetInfo<Target>(Triple, Opts) {
|
||||
this->WCharType = TargetInfo::UnsignedInt;
|
||||
}
|
||||
};
|
||||
|
||||
void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,
|
||||
|
|
|
@ -3409,8 +3409,8 @@ static void RenderCharacterOptions(const ArgList &Args, const llvm::Triple &T,
|
|||
} else {
|
||||
bool IsARM = T.isARM() || T.isThumb() || T.isAArch64();
|
||||
CmdArgs.push_back("-fwchar-type=int");
|
||||
if (IsARM && !(T.isOSWindows() || T.isOSNetBSD() ||
|
||||
T.isOSOpenBSD()))
|
||||
if (T.isOSzOS() ||
|
||||
(IsARM && !(T.isOSWindows() || T.isOSNetBSD() || T.isOSOpenBSD())))
|
||||
CmdArgs.push_back("-fno-signed-wchar");
|
||||
else
|
||||
CmdArgs.push_back("-fsigned-wchar");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s -check-prefix=LONG-WCHAR
|
||||
// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -emit-llvm -o - %s | FileCheck %s -check-prefix=SHORT-WCHAR
|
||||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - -fwchar-type=short -fno-signed-wchar %s | FileCheck %s -check-prefix=SHORT-WCHAR
|
||||
// RUN: %clang_cc1 -triple s390x-none-zos -emit-llvm -o - %s | FileCheck %s -check-prefix=LONG-WCHAR
|
||||
// Note: -fno-short-wchar implies the target default is used; so there is no
|
||||
// need to test this separately here.
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=CHECK-X86
|
||||
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=CHECK-ARM
|
||||
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple thumbv7-none-eabi | FileCheck %s --check-prefix=CHECK-ARM
|
||||
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple s390x-none-zos | FileCheck %s --check-prefix=CHECK-ZOS
|
||||
|
||||
// CHECK-X86-NOT: #define __WCHAR_UNSIGNED__
|
||||
// CHECK-X86: #define __WINT_UNSIGNED__ 1
|
||||
|
||||
// CHECK-ARM: #define __WCHAR_UNSIGNED__ 1
|
||||
// CHECK-ARM-NOT: #define __WINT_UNSIGNED__ 1
|
||||
|
||||
// CHECK-ZOS: #define __WCHAR_UNSIGNED__ 1
|
||||
// CHECK-ZOS-NOT: #define __WINT_UNSIGNED__ 1
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
// CHECK-ARM64-AAPCS64-DAG: #define __WCHAR_TYPE__ unsigned int
|
||||
// CHECK-ARM64-AAPCS64-DAG: #define __WCHAR_UNSIGNED__ 1
|
||||
|
||||
// RUN: %clang_cc1 -triple s390x-none-zos -fwchar-type=int -fno-signed-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ZOS
|
||||
// CHECK-ZOS: #define __WCHAR_MAX__ 4294967295U
|
||||
// CHECK-ZOS: #define __WCHAR_TYPE__ unsigned int
|
||||
// CHECK-ZOS: #define __WCHAR_UNSIGNED__ 1
|
||||
|
||||
// RUN: %clang_cc1 -triple xcore-unknown-unknown -fwchar-type=char -fno-signed-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-XCORE
|
||||
// CHECK-XCORE-DAG: #define __WCHAR_MAX__ 255
|
||||
// CHECK-XCORE-DAG: #define __WCHAR_TYPE__ unsigned char
|
||||
|
|
|
@ -6,7 +6,7 @@ typedef __WCHAR_TYPE__ wchar_t;
|
|||
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
|
||||
|| defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR)
|
||||
#define WCHAR_T_TYPE unsigned short
|
||||
#elif defined(__arm) || defined(__aarch64__)
|
||||
#elif defined(__arm) || defined(__aarch64__) || defined(__MVS__)
|
||||
#define WCHAR_T_TYPE unsigned int
|
||||
#elif defined(__sun)
|
||||
#if defined(__LP64__)
|
||||
|
|
Loading…
Reference in New Issue