summaryrefslogtreecommitdiff
path: root/test/Preprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'test/Preprocessor')
-rw-r--r--test/Preprocessor/expr_usual_conversions.c5
-rw-r--r--test/Preprocessor/if_warning.c6
-rw-r--r--test/Preprocessor/init.c10
-rw-r--r--test/Preprocessor/line-directive-output.c71
-rw-r--r--test/Preprocessor/non_fragile_feature.m4
-rw-r--r--test/Preprocessor/output_paste_avoid.c5
6 files changed, 95 insertions, 6 deletions
diff --git a/test/Preprocessor/expr_usual_conversions.c b/test/Preprocessor/expr_usual_conversions.c
index b1bddd34546cf..5ca2cb867b2df 100644
--- a/test/Preprocessor/expr_usual_conversions.c
+++ b/test/Preprocessor/expr_usual_conversions.c
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 %s -E 2>&1 | grep warning | wc -l | grep 2
+// RUN: %clang_cc1 %s -E -verify
#define INTMAX_MIN (-9223372036854775807LL -1)
-#if (-42 + 0U) / -2
+#if (-42 + 0U) /* expected-warning {{left side of operator converted from negative value to unsigned: -42 to 18446744073709551574}} */ \
+ / -2 /* expected-warning {{right side of operator converted from negative value to unsigned: -2 to 18446744073709551614}} */
foo
#endif
diff --git a/test/Preprocessor/if_warning.c b/test/Preprocessor/if_warning.c
index 98653a8feef6d..345ac95eb4ba8 100644
--- a/test/Preprocessor/if_warning.c
+++ b/test/Preprocessor/if_warning.c
@@ -19,3 +19,9 @@ extern int x;
#else 1 // Should not warn due to C99 6.10p4
#endif
#endif
+
+
+// PR6852
+#if 'somesillylongthing' // expected-warning {{character constant too long for its type}} \
+ // expected-warning {{multi-character character constant}}
+#endif
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index cccee762e264b..b9850983a2a14 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -11,7 +11,6 @@
//
// RUN: %clang_cc1 -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s
//
-// CXX0X:#define _GNU_SOURCE 1
// CXX0X:#define __DEPRECATED 1
// CXX0X:#define __GNUG__
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
@@ -22,7 +21,6 @@
//
// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
//
-// CXX98:#define _GNU_SOURCE 1
// CXX98:#define __DEPRECATED 1
// CXX98:#define __GNUG__
// CXX98:#define __GXX_WEAK__ 1
@@ -50,6 +48,10 @@
// COMMON:#define __STDC__ 1
// COMMON:#define __VERSION__
// COMMON:#define __clang__ 1
+// COMMON:#define __clang_major__ 2
+// COMMON:#define __clang_minor__ 0
+// COMMON:#define __clang_patchlevel__ 0
+// COMMON:#define __clang_version__
// COMMON:#define __llvm__ 1
//
//
@@ -58,7 +60,6 @@
//
// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
//
-// GXX98:#define _GNU_SOURCE 1
// GXX98:#define __DEPRECATED 1
// GXX98:#define __GNUG__
// GXX98:#define __GXX_WEAK__ 1
@@ -1028,3 +1029,6 @@
// X86_64:#define __x86_64 1
// X86_64:#define __x86_64__ 1
//
+// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
+// GNUSOURCE:#define _GNU_SOURCE 1
+//
diff --git a/test/Preprocessor/line-directive-output.c b/test/Preprocessor/line-directive-output.c
new file mode 100644
index 0000000000000..290703a50e3ba
--- /dev/null
+++ b/test/Preprocessor/line-directive-output.c
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s -strict-whitespace
+// PR6101
+int a;
+// CHECK: # 1 "{{.*}}line-directive-output.c"
+// CHECK: int a;
+
+// CHECK-NEXT: # 50 "{{.*}}line-directive-output.c"
+// CHECK-NEXT: int b;
+#line 50
+int b;
+
+// CHECK: # 13 "{{.*}}line-directive-output.c"
+// CHECK-NEXT: int c;
+# 13
+int c;
+
+
+// CHECK-NEXT: # 1 "A.c"
+#line 1 "A.c"
+// CHECK-NEXT: # 2 "A.c"
+#line 2
+
+// CHECK-NEXT: # 1 "B.c"
+#line 1 "B.c"
+
+// CHECK-NEXT: # 1000 "A.c"
+#line 1000 "A.c"
+
+int y;
+
+
+
+
+
+
+
+// CHECK: # 1010 "A.c"
+int z;
+
+extern int x;
+
+# 3 "temp2.h" 1
+extern int y;
+
+# 7 "A.c" 2
+extern int z;
+
+
+
+
+
+
+
+
+
+
+
+
+
+// CHECK: # 25 "A.c"
+
+
+// CHECK: # 50 "C.c" 1
+# 50 "C.c" 1
+
+
+// CHECK-NEXT: # 2000 "A.c" 2
+# 2000 "A.c" 2
+# 42 "A.c"
+# 44 "A.c"
+# 49 "A.c"
diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m
index 552209d4955e1..1f67ed3f09bd3 100644
--- a/test/Preprocessor/non_fragile_feature.m
+++ b/test/Preprocessor/non_fragile_feature.m
@@ -6,3 +6,7 @@
#if !__has_feature(objc_nonfragile_abi)
#error Non-fragile ABI used for compilation but feature macro not set.
#endif
+
+#if !__has_feature(objc_weak_class)
+#error objc_weak_class should be enabled with nonfragile abi
+#endif
diff --git a/test/Preprocessor/output_paste_avoid.c b/test/Preprocessor/output_paste_avoid.c
index 8c6173a78d1d0..8e4f3a4bf4d96 100644
--- a/test/Preprocessor/output_paste_avoid.c
+++ b/test/Preprocessor/output_paste_avoid.c
@@ -4,8 +4,11 @@
#define y(a) ..a
A: y(.)
// This should print as ".. ." to avoid turning into ...
-// CHECK: A: . . .
+// CHECK: A: .. .
+#define X 0 .. 1
+B: X
+// CHECK: B: 0 .. 1
#define DOT .
C: ..DOT