aboutsummaryrefslogtreecommitdiff
path: root/test/Frontend
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
commit36981b17ed939300f6f8fc2355a255f711fcef71 (patch)
treeee2483e98b09cac943dc93a6969d83ca737ff139 /test/Frontend
parent180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff)
downloadsrc-36981b17ed939300f6f8fc2355a255f711fcef71.tar.gz
src-36981b17ed939300f6f8fc2355a255f711fcef71.zip
Vendor import of clang release_30 branch r142614:vendor/clang/clang-r142614
Notes
Notes: svn path=/vendor/clang/dist/; revision=226586 svn path=/vendor/clang/clang-r142614/; revision=226587; tag=vendor/clang/clang-r142614
Diffstat (limited to 'test/Frontend')
-rw-r--r--test/Frontend/Weverything.c9
-rw-r--r--test/Frontend/diagnostics-option-names.c8
-rw-r--r--test/Frontend/warning-mapping-1.c6
-rw-r--r--test/Frontend/warning-mapping-2.c5
-rw-r--r--test/Frontend/warning-mapping-3.c10
-rw-r--r--test/Frontend/warning-mapping-4.c6
-rw-r--r--test/Frontend/warning-mapping-5.c9
7 files changed, 53 insertions, 0 deletions
diff --git a/test/Frontend/Weverything.c b/test/Frontend/Weverything.c
new file mode 100644
index 000000000000..32f314720b24
--- /dev/null
+++ b/test/Frontend/Weverything.c
@@ -0,0 +1,9 @@
+// Regression check that -pedantic-errors doesn't cause other diagnostics to
+// become errors.
+//
+// RUN: %clang_cc1 -verify -Weverything -pedantic-errors %s
+
+int f0(int, unsigned);
+int f0(int x, unsigned y) {
+ return x < y; // expected-warning {{comparison of integers}}
+}
diff --git a/test/Frontend/diagnostics-option-names.c b/test/Frontend/diagnostics-option-names.c
new file mode 100644
index 000000000000..ed0d2ed8ef9e
--- /dev/null
+++ b/test/Frontend/diagnostics-option-names.c
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -fdiagnostics-show-option -Werror -Weverything %s 2> %t
+// RUN: FileCheck < %t %s
+
+int f0(int, unsigned);
+int f0(int x, unsigned y) {
+// CHECK: comparison of integers of different signs{{.*}} [-Werror,-Wsign-compare]
+ return x < y; // expected-error {{ : 'int' and 'unsigned int' }}
+}
diff --git a/test/Frontend/warning-mapping-1.c b/test/Frontend/warning-mapping-1.c
new file mode 100644
index 000000000000..883dafb1f500
--- /dev/null
+++ b/test/Frontend/warning-mapping-1.c
@@ -0,0 +1,6 @@
+// Check that -w has higher priority than -Werror.
+// RUN: %clang_cc1 -verify -Wsign-compare -Werror -w %s
+
+int f0(int x, unsigned y) {
+ return x < y;
+}
diff --git a/test/Frontend/warning-mapping-2.c b/test/Frontend/warning-mapping-2.c
new file mode 100644
index 000000000000..39ba4997a4fa
--- /dev/null
+++ b/test/Frontend/warning-mapping-2.c
@@ -0,0 +1,5 @@
+// Check that -w has lower priority than -pedantic-errors.
+// RUN: %clang_cc1 -verify -pedantic-errors -w %s
+
+void f0() { f1(); } // expected-error {{implicit declaration of function}}
+
diff --git a/test/Frontend/warning-mapping-3.c b/test/Frontend/warning-mapping-3.c
new file mode 100644
index 000000000000..8c701903f4e8
--- /dev/null
+++ b/test/Frontend/warning-mapping-3.c
@@ -0,0 +1,10 @@
+// Check that -Werror and -Wfatal-error interact properly.
+//
+// Verify mode doesn't work with fatal errors, just use FileCheck here.
+//
+// RUN: not %clang_cc1 -Wunused-function -Werror -Wfatal-errors %s 2> %t.err
+// RUN: FileCheck < %t.err %s
+// CHECK: fatal error: unused function
+// CHECK: 1 error generated
+
+static void f0(void) {} // expected-fatal {{unused function}}
diff --git a/test/Frontend/warning-mapping-4.c b/test/Frontend/warning-mapping-4.c
new file mode 100644
index 000000000000..d8d2769fc535
--- /dev/null
+++ b/test/Frontend/warning-mapping-4.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -verify -Wno-error=sign-compare %s
+// RUN: %clang_cc1 -verify -Wsign-compare -w -Wno-error=sign-compare %s
+
+int f0(int x, unsigned y) {
+ return x < y;
+}
diff --git a/test/Frontend/warning-mapping-5.c b/test/Frontend/warning-mapping-5.c
new file mode 100644
index 000000000000..27d53dc18915
--- /dev/null
+++ b/test/Frontend/warning-mapping-5.c
@@ -0,0 +1,9 @@
+// Check that #pragma diagnostic warning overrides -Werror. This matches GCC's
+// original documentation, but not its earlier implementations.
+//
+// RUN: %clang_cc1 -verify -Werror %s
+
+#pragma clang diagnostic warning "-Wsign-compare"
+int f0(int x, unsigned y) {
+ return x < y; // expected-warning {{comparison of integers}}
+}