blob: 77c4c0150129303f0edb1a1a32ad7c2e6c6e19d1 [file] [log] [blame]
Eli Friedman7d14b3c2012-10-23 20:19:32 +00001// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify %s
2
3// Variable declarations that should trigger a warning.
4int vbad1; // expected-warning{{no previous extern declaration for non-static variable 'vbad1'}}
5int vbad2 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad2'}}
6
7// Variable declarations that should not trigger a warning.
8static int vgood1;
9extern int vgood2;
10int vgood2;
11static struct {
12 int mgood1;
13} vgood3;
14
15// Functions should never trigger a warning.
16void fgood1(void);
17void fgood2(void) {
18 int lgood1;
19 static int lgood2;
20}
21static void fgood3(void) {
22 int lgood3;
23 static int lgood4;
24}
25
26// Structures, namespaces and classes should be unaffected.
27struct sgood1 {
28 int mgood2;
29};
30struct {
31 int mgood3;
32} sgood2;
33class CGood1 {
34 static int MGood1;
35};
36int CGood1::MGood1;
37namespace {
38 int mgood4;
39}