xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/warn-unused-parameters.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused-parameter %s 2>&1 | FileCheck %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused %s 2>&1 | FileCheck -check-prefix=CHECK-unused %s
3*f4a2713aSLionel Sambuc 
f0(int x,int y,int z)4*f4a2713aSLionel Sambuc int f0(int x,
5*f4a2713aSLionel Sambuc        int y,
6*f4a2713aSLionel Sambuc        int z __attribute__((unused))) {
7*f4a2713aSLionel Sambuc   return x;
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
f1()10*f4a2713aSLionel Sambuc void f1() {
11*f4a2713aSLionel Sambuc   (void)^(int x,
12*f4a2713aSLionel Sambuc           int y,
13*f4a2713aSLionel Sambuc           int z __attribute__((unused))) { return x; };
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // Used when testing '-Wunused' to see that we only emit one diagnostic, and no
17*f4a2713aSLionel Sambuc // warnings for the above cases.
achor()18*f4a2713aSLionel Sambuc static void achor() {};
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc // CHECK: 5:12: warning: unused parameter 'y'
21*f4a2713aSLionel Sambuc // CHECK: 12:15: warning: unused parameter 'y'
22*f4a2713aSLionel Sambuc // CHECK-unused: 1 warning generated
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything %s 2>&1 | FileCheck -check-prefix=CHECK-everything %s
25*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -fblocks -fsyntax-only -Weverything -Werror %s 2>&1 | FileCheck -check-prefix=CHECK-everything-error %s
26*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fblocks -fsyntax-only -Weverything -Wno-unused %s 2>&1 | FileCheck -check-prefix=CHECK-everything-no-unused %s
27*f4a2713aSLionel Sambuc // CHECK-everything: 6 warnings generated
28*f4a2713aSLionel Sambuc // CHECK-everything-error: 5 errors generated
29*f4a2713aSLionel Sambuc // CHECK-everything-no-unused: 5 warnings generated
30*f4a2713aSLionel Sambuc 
31