annotate clang/test/SemaCXX/warn-unused-label-error.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 static int unused_local_static;
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 namespace PR8455 {
anatofuz
parents:
diff changeset
6 void f() {
anatofuz
parents:
diff changeset
7 A: // expected-warning {{unused label 'A'}}
anatofuz
parents:
diff changeset
8 __attribute__((unused)) int i; // attribute applies to variable
anatofuz
parents:
diff changeset
9 B: // attribute applies to label
anatofuz
parents:
diff changeset
10 __attribute__((unused)); int j; // expected-warning {{unused variable 'j'}}
anatofuz
parents:
diff changeset
11 }
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 void g() {
anatofuz
parents:
diff changeset
14 C: // unused label 'C' will not appear here because an error has occurred
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
15 __attribute__((unused)) // expected-error {{an attribute list cannot appear here}}
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
16 #pragma weak unused_local_static
150
anatofuz
parents:
diff changeset
17 ;
anatofuz
parents:
diff changeset
18 }
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 void h() {
anatofuz
parents:
diff changeset
21 D:
anatofuz
parents:
diff changeset
22 #pragma weak unused_local_static
anatofuz
parents:
diff changeset
23 __attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
anatofuz
parents:
diff changeset
24 ;
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 }