blob: af048e77e886aea447858822a20398783daa8ee9 [file] [log] [blame]
Ted Kremenek355fa3a2010-04-08 23:17:16 +00001// RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused-parameter %s 2>&1 | FileCheck %s
2// RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused %s 2>&1 | FileCheck -check-prefix=CHECK-unused %s
Douglas Gregore0762c92009-06-19 23:52:42 +00003
4int f0(int x,
Ted Kremenekb4c0c2d2010-04-08 21:10:56 +00005 int y,
Douglas Gregore0762c92009-06-19 23:52:42 +00006 int z __attribute__((unused))) {
7 return x;
8}
9
10void f1() {
11 (void)^(int x,
Ted Kremenekb4c0c2d2010-04-08 21:10:56 +000012 int y,
Douglas Gregore0762c92009-06-19 23:52:42 +000013 int z __attribute__((unused))) { return x; };
Douglas Gregor6aed7662009-06-20 00:29:46 +000014}
Ted Kremenekb4c0c2d2010-04-08 21:10:56 +000015
16// Used when testing '-Wunused' to see that we only emit one diagnostic, and no
17// warnings for the above cases.
18static void achor() {};
19
20// CHECK: 5:12: warning: unused parameter 'y'
21// CHECK: 12:15: warning: unused parameter 'y'
Ted Kremenek1e473cc2011-08-18 01:12:56 +000022// CHECK-unused: 1 warning generated
23
24// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything %s 2>&1 | FileCheck -check-prefix=CHECK-everything %s
25// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Werror %s 2>&1 | FileCheck -check-prefix=CHECK-everything-error %s
26// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Wno-unused %s 2>&1 | FileCheck -check-prefix=CHECK-everything-no-unused %s
27// CHECK-everything: 6 warnings generated
28// CHECK-everything-error: 5 errors generated
29// CHECK-everything-no-unused: 5 warnings generated
30