]> granicus.if.org Git - clang/commitdiff
tests: Add some more tests for warning mappings.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 29 Sep 2011 01:37:40 +0000 (01:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 29 Sep 2011 01:37:40 +0000 (01:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140764 91177308-0d34-0410-b5e6-96231b3b80d8

test/Frontend/Weverything.c [new file with mode: 0644]
test/Frontend/warning-mapping-1.c [new file with mode: 0644]
test/Frontend/warning-mapping-2.c [new file with mode: 0644]
test/Frontend/warning-mapping-3.c [new file with mode: 0644]

diff --git a/test/Frontend/Weverything.c b/test/Frontend/Weverything.c
new file mode 100644 (file)
index 0000000..7c87a2c
--- /dev/null
@@ -0,0 +1,12 @@
+// Regression check that -pedantic-errors doesn't cause other diagnostics to
+// become errors.
+//
+// RUN: %clang_cc1 -verify -Weverything -pedantic-errors %s
+//
+// FIXME: This is currently broken.
+// XFAIL: *
+
+int f0(int, unsigned);
+int f0(int x, unsigned y) {
+  return x < y; // expected-warning {{comparison of integers}}
+}
diff --git a/test/Frontend/warning-mapping-1.c b/test/Frontend/warning-mapping-1.c
new file mode 100644 (file)
index 0000000..883dafb
--- /dev/null
@@ -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 (file)
index 0000000..5a347eb
--- /dev/null
@@ -0,0 +1,8 @@
+// Check that -w has lower priority than -pedantic-errors.
+// RUN: %clang_cc1 -verify -pedantic-errors -w %s
+//
+// FIXME: We currently get this wrong.
+// XFAIL: *
+
+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 (file)
index 0000000..8c70190
--- /dev/null
@@ -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}}