summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-extra-semi.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-05-16 19:04:59 +0000
committerRichard Trieu <rtrieu@google.com>2012-05-16 19:04:59 +0000
commit2f7dc46a5868db54f5a96e3a7308cad6970c0e4b (patch)
treee6c0a659e4d59be74b1b89330ea5f7228797b616 /clang/test/Parser/cxx-extra-semi.cpp
parent8c17fbd6c167687fca630b91ba007265e6a9c424 (diff)
downloadbcm5719-llvm-2f7dc46a5868db54f5a96e3a7308cad6970c0e4b.tar.gz
bcm5719-llvm-2f7dc46a5868db54f5a96e3a7308cad6970c0e4b.zip
Move the warnings for extra semi-colons under -Wextra-semi. Also, added
a warning for an extra semi-colon after function definitions. Added logic so that a block of semi-colons on a line will only get one warning instead of a warning for each semi-colon. llvm-svn: 156934
Diffstat (limited to 'clang/test/Parser/cxx-extra-semi.cpp')
-rw-r--r--clang/test/Parser/cxx-extra-semi.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-extra-semi.cpp b/clang/test/Parser/cxx-extra-semi.cpp
new file mode 100644
index 00000000000..35c886b63b2
--- /dev/null
+++ b/clang/test/Parser/cxx-extra-semi.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t
+// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t
+
+class A {
+ void A1();
+ void A2() { }; // expected-warning{{extra ';' after function definition}}
+ ; // expected-warning{{extra ';' inside a class}}
+ void A3() { }; ;; // expected-warning{{extra ';' after function definition}}
+ ;;;;;;; // expected-warning{{extra ';' inside a class}}
+ ; // expected-warning{{extra ';' inside a class}}
+ ; ;; ; ;;; // expected-warning{{extra ';' inside a class}}
+ ; ; ; ; ;; // expected-warning{{extra ';' inside a class}}
+ void A4();
+};
+
+union B {
+ int a1;
+ int a2;; // expected-warning{{extra ';' inside a union}}
+};
+
+; // expected-warning{{extra ';' outside of a function}}
+; ;;// expected-warning{{extra ';' outside of a function}}
+
OpenPOWER on IntegriCloud