From: Daniel Dunbar Date: Thu, 29 Sep 2011 01:37:40 +0000 (+0000) Subject: tests: Add some more tests for warning mappings. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70456e95a5a50b1a017822e9e6dec49fd9851076;p=clang tests: Add some more tests for warning mappings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140764 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Frontend/Weverything.c b/test/Frontend/Weverything.c new file mode 100644 index 0000000000..7c87a2cca1 --- /dev/null +++ b/test/Frontend/Weverything.c @@ -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 index 0000000000..883dafb1f5 --- /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 0000000000..5a347ebb09 --- /dev/null +++ b/test/Frontend/warning-mapping-2.c @@ -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 index 0000000000..8c701903f4 --- /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}}