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