summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Driver/clang_f_opts.c3
-rw-r--r--clang/test/Sema/wchar.c20
2 files changed, 16 insertions, 7 deletions
diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c
index 8266f776239..7aecbac49c2 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -2,10 +2,11 @@
// RUN: grep -F '"-fblocks"' %t &&
// RUN: grep -F '"--fmath-errno=1"' %t &&
// RUN: grep -F '"-fpascal-strings"' %t &&
-// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location %s 2> %t &&
+// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2> %t &&
// RUN: grep -F '"-fblocks=0"' %t &&
// RUN: grep -F '"-fbuiltin=0"' %t &&
// RUN: grep -F '"-fno-common"' %t &&
// RUN: grep -F '"--fmath-errno=0"' %t &&
// RUN: grep -F '"-fno-show-source-location"' %t &&
+// RUN: grep -F '"-fshort-wchar"' %t &&
// RUN: true
diff --git a/clang/test/Sema/wchar.c b/clang/test/Sema/wchar.c
index 16376009ab1..bf1996b4aa2 100644
--- a/clang/test/Sema/wchar.c
+++ b/clang/test/Sema/wchar.c
@@ -1,12 +1,20 @@
-// RUN: clang-cc %s -fsyntax-only -verify
+// RUN: clang-cc %s -fsyntax-only -verify &&
+// RUN: clang-cc %s -fsyntax-only -fshort-wchar -verify -DSHORT_WCHAR
+
#include <wchar.h>
-
+
+#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
+ || defined(_M_X64) || defined(SHORT_WCHAR)
+ #define WCHAR_T_TYPE unsigned short
+#else
+ #define WCHAR_T_TYPE int
+#endif
+
int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
-
+
void foo() {
- int t1[] = L"x";
+ WCHAR_T_TYPE t1[] = L"x";
wchar_t tab[] = L"x";
-
- int t2[] = "x"; // expected-error {{initialization}}
+ WCHAR_T_TYPE t2[] = "x"; // expected-error {{initialization}}
char t3[] = L"x"; // expected-error {{initialization}}
}
OpenPOWER on IntegriCloud