summaryrefslogtreecommitdiff
path: root/clang/test/Headers
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
commit222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch)
tree7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/Headers
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/Headers')
-rw-r--r--clang/test/Headers/arm-neon-header.c5
-rw-r--r--clang/test/Headers/c89.c10
-rw-r--r--clang/test/Headers/int64-type.c4
-rw-r--r--clang/test/Headers/stdbool.cpp14
-rw-r--r--clang/test/Headers/typedef_guards.c28
-rw-r--r--clang/test/Headers/wchar_limits.cpp9
-rw-r--r--clang/test/Headers/wmmintrin.c4
-rw-r--r--clang/test/Headers/x86-intrinsics-headers.c15
8 files changed, 89 insertions, 0 deletions
diff --git a/clang/test/Headers/arm-neon-header.c b/clang/test/Headers/arm-neon-header.c
new file mode 100644
index 0000000..90ea22b
--- /dev/null
+++ b/clang/test/Headers/arm-neon-header.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -fno-lax-vector-conversions -ffreestanding %s
+// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
+
+#include <arm_neon.h>
diff --git a/clang/test/Headers/c89.c b/clang/test/Headers/c89.c
new file mode 100644
index 0000000..eea8d44
--- /dev/null
+++ b/clang/test/Headers/c89.c
@@ -0,0 +1,10 @@
+// RUN: %clang -target i386-apple-darwin10 -fsyntax-only -Xclang -verify -std=c89 %s
+
+// FIXME: Disable inclusion of mm_malloc.h, our current implementation is broken
+// on win32 since we don't generally know how to find errno.h.
+
+#define __MM_MALLOC_H
+
+// PR6658
+#include <xmmintrin.h>
+
diff --git a/clang/test/Headers/int64-type.c b/clang/test/Headers/int64-type.c
new file mode 100644
index 0000000..16b42d2
--- /dev/null
+++ b/clang/test/Headers/int64-type.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -verify %s -ffreestanding
+
+#include <stdint.h>
+typedef unsigned long long uint64_t;
diff --git a/clang/test/Headers/stdbool.cpp b/clang/test/Headers/stdbool.cpp
new file mode 100644
index 0000000..a252cca
--- /dev/null
+++ b/clang/test/Headers/stdbool.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -E -dM %s | FileCheck --check-prefix=CHECK-GNU-COMPAT %s
+// RUN: %clang_cc1 -std=c++98 -E -dM %s | FileCheck --check-prefix=CHECK-CONFORMING %s
+#include <stdbool.h>
+#define zzz
+
+// CHECK-GNU-COMPAT: #define _Bool bool
+// CHECK-GNU-COMPAT: #define bool bool
+// CHECK-GNU-COMPAT: #define false false
+// CHECK-GNU-COMPAT: #define true true
+
+// CHECK-CONFORMING-NOT: #define _Bool
+// CHECK-CONFORMING: #define __CHAR_BIT__
+// CHECK-CONFORMING-NOT: #define false false
+// CHECK-CONFORMING: #define zzz
diff --git a/clang/test/Headers/typedef_guards.c b/clang/test/Headers/typedef_guards.c
new file mode 100644
index 0000000..646b2ca
--- /dev/null
+++ b/clang/test/Headers/typedef_guards.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// NULL is rdefined in stddef.h
+#define NULL ((void*) 0)
+
+// These are headers bundled with Clang.
+#include <stdarg.h>
+#include <stddef.h>
+
+#ifndef _VA_LIST
+typedef __builtin_va_list va_list;
+#endif
+
+#ifndef _SIZE_T
+typedef __typeof__(sizeof(int)) size_t;
+#endif
+
+#ifndef _WCHAR_T
+typedef __typeof__(*L"") wchar_t;
+#endif
+
+extern void foo(wchar_t x);
+extern void bar(size_t x);
+void *baz() { return NULL; }
+void quz() {
+ va_list y;
+}
+
diff --git a/clang/test/Headers/wchar_limits.cpp b/clang/test/Headers/wchar_limits.cpp
new file mode 100644
index 0000000..93a99ad
--- /dev/null
+++ b/clang/test/Headers/wchar_limits.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify %s
+// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -fshort-wchar %s
+
+#include <stdint.h>
+
+const bool swchar = (wchar_t)-1 > (wchar_t)0;
+
+int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar_t)-1)];
+int min_test[WCHAR_MIN == (swchar ? 0 : -WCHAR_MAX-1)];
diff --git a/clang/test/Headers/wmmintrin.c b/clang/test/Headers/wmmintrin.c
new file mode 100644
index 0000000..6aa8be4
--- /dev/null
+++ b/clang/test/Headers/wmmintrin.c
@@ -0,0 +1,4 @@
+// Check that wmmintrin.h is includable with just -maes.
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown \
+// RUN: -verify %s -ffreestanding -target-feature +aes
+#include <wmmintrin.h>
diff --git a/clang/test/Headers/x86-intrinsics-headers.c b/clang/test/Headers/x86-intrinsics-headers.c
new file mode 100644
index 0000000..bdffdde
--- /dev/null
+++ b/clang/test/Headers/x86-intrinsics-headers.c
@@ -0,0 +1,15 @@
+// RUN: %clang -fsyntax-only -ffreestanding %s
+// RUN: %clang -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s
+// RUN: %clangxx -fsyntax-only -ffreestanding -x c++ %s
+
+#if defined(i386) || defined(__x86_64__)
+
+#ifdef __SSE4_2__
+// nmmintrin forwards to smmintrin.
+#include <nmmintrin.h>
+#endif
+
+// immintrin includes all other intel intrinsic headers.
+#include <immintrin.h>
+
+#endif