blob: 4d1cde7067e514150b3a58e0e939f55382c82795 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
Douglas Gregor3beaf9b2009-10-08 21:35:42 +00002
3struct s0 {
4 unsigned int i;
5};
6
7int proto(int a, int b);
8
9void f0(void) {
10 int a __attribute__((unused)),
11 b; // expected-warning{{unused}}
12 return;
13}
14
15void f1(void) {
16 int i;
17 (void)sizeof(i);
18 return;
19}
Chris Lattnerefc83e62010-03-01 21:06:03 +000020
21// PR5933
22int f2() {
23 int X = 4; // Shouldn't have a bogus 'unused variable X' warning.
24 return Y + X; // expected-error {{use of undeclared identifier 'Y'}}
25}