annotate clang/test/Sema/wchar.c @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -fsyntax-only -verify
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 %s -fsyntax-only -fwchar-type=short -fno-signed-wchar -verify -DSHORT_WCHAR
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 typedef __WCHAR_TYPE__ wchar_t;
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 #if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
anatofuz
parents:
diff changeset
7 || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR)
anatofuz
parents:
diff changeset
8 #define WCHAR_T_TYPE unsigned short
anatofuz
parents:
diff changeset
9 #elif defined(__arm) || defined(__aarch64__)
anatofuz
parents:
diff changeset
10 #define WCHAR_T_TYPE unsigned int
anatofuz
parents:
diff changeset
11 #elif defined(__sun)
anatofuz
parents:
diff changeset
12 #if defined(__LP64__)
anatofuz
parents:
diff changeset
13 #define WCHAR_T_TYPE int
anatofuz
parents:
diff changeset
14 #else
anatofuz
parents:
diff changeset
15 #define WCHAR_T_TYPE long
anatofuz
parents:
diff changeset
16 #endif
anatofuz
parents:
diff changeset
17 #else /* Solaris. */
anatofuz
parents:
diff changeset
18 #define WCHAR_T_TYPE int
anatofuz
parents:
diff changeset
19 #endif
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 void foo() {
anatofuz
parents:
diff changeset
24 WCHAR_T_TYPE t1[] = L"x";
anatofuz
parents:
diff changeset
25 wchar_t tab[] = L"x";
anatofuz
parents:
diff changeset
26 WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}}
anatofuz
parents:
diff changeset
27 char t3[] = L"x"; // expected-error {{initializing char array with wide string literal}}
anatofuz
parents:
diff changeset
28 }