summaryrefslogtreecommitdiff
path: root/test/Sema/warn-missing-variable-declarations.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/warn-missing-variable-declarations.c')
-rw-r--r--test/Sema/warn-missing-variable-declarations.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Sema/warn-missing-variable-declarations.c b/test/Sema/warn-missing-variable-declarations.c
new file mode 100644
index 000000000000..631d3d213b01
--- /dev/null
+++ b/test/Sema/warn-missing-variable-declarations.c
@@ -0,0 +1,18 @@
+// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify %s
+
+int vbad1; // expected-warning{{no previous extern declaration for non-static variable 'vbad1'}}
+
+int vbad2;
+int vbad2 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad2'}}
+
+struct {
+ int mgood1;
+} vbad3; // expected-warning{{no previous extern declaration for non-static variable 'vbad3'}}
+
+int vbad4;
+int vbad4 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad4'}}
+extern int vbad4;
+
+extern int vgood1;
+int vgood1;
+int vgood1 = 10;