blob: 11db7300c5c4368c813fec53ab0a451ffc4d10fd [file] [log] [blame]
Ted Kremeneke1a38ab2010-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 Gregorc9c02ed2009-06-19 23:52:42 +00003
4int f0(int x,
Ted Kremenek5c7f5962010-04-08 21:10:56 +00005 int y,
Douglas Gregorc9c02ed2009-06-19 23:52:42 +00006 int z __attribute__((unused))) {
7 return x;
8}
9
10void f1() {
11 (void)^(int x,
Ted Kremenek5c7f5962010-04-08 21:10:56 +000012 int y,
Douglas Gregorc9c02ed2009-06-19 23:52:42 +000013 int z __attribute__((unused))) { return x; };
Douglas Gregor6fa36b42009-06-20 00:29:46 +000014}
Ted Kremenek5c7f5962010-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 Kremenekfbbdced2011-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
Rafael Espindola925213b2013-07-04 16:16:58 +000025// RUN: not %clang_cc1 -fblocks -fsyntax-only -Weverything -Werror %s 2>&1 | FileCheck -check-prefix=CHECK-everything-error %s
Ted Kremenekfbbdced2011-08-18 01:12:56 +000026// RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Wno-unused %s 2>&1 | FileCheck -check-prefix=CHECK-everything-no-unused %s
Fariborz Jahanian197c68c2012-03-06 18:41:35 +000027// CHECK-everything: 6 warnings generated
28// CHECK-everything-error: 5 errors generated
29// CHECK-everything-no-unused: 5 warnings generated
Ted Kremenekfbbdced2011-08-18 01:12:56 +000030