diff options
Diffstat (limited to 'test/Frontend')
-rw-r--r-- | test/Frontend/Weverything.c | 9 | ||||
-rw-r--r-- | test/Frontend/diagnostics-option-names.c | 8 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-1.c | 6 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-2.c | 5 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-3.c | 10 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-4.c | 6 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-5.c | 9 |
7 files changed, 53 insertions, 0 deletions
diff --git a/test/Frontend/Weverything.c b/test/Frontend/Weverything.c new file mode 100644 index 0000000000000..32f314720b248 --- /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 0000000000000..ed0d2ed8ef9e0 --- /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 0000000000000..883dafb1f5006 --- /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 0000000000000..39ba4997a4fa1 --- /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 0000000000000..8c701903f4e87 --- /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 0000000000000..d8d2769fc5353 --- /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 0000000000000..27d53dc189153 --- /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}} +} |