aboutsummaryrefslogtreecommitdiff
path: root/test
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
commit4b0e6f1da341510c1ad83eaf4c836f3134d0156a (patch)
tree2dff3a69b5a063baa3ca503771b8cf6f5db4e9c5 /test
parent533718fb27f87a25bf9f6fdd69df4a4ce8b783a6 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Misc/warning-flags.c5
-rw-r--r--test/Parser/cxx-class.cpp4
-rw-r--r--test/Parser/cxx-extra-semi.cpp25
3 files changed, 28 insertions, 6 deletions
diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c
index e899517619..98130c5e27 100644
--- a/test/Misc/warning-flags.c
+++ b/test/Misc/warning-flags.c
@@ -17,7 +17,7 @@ This test serves two purposes:
The list of warnings below should NEVER grow. It should gradually shrink to 0.
-CHECK: Warnings without flags (245):
+CHECK: Warnings without flags (242):
CHECK-NEXT: ext_anonymous_struct_union_qualified
CHECK-NEXT: ext_binary_literal
CHECK-NEXT: ext_cast_fn_obj
@@ -33,8 +33,6 @@ CHECK-NEXT: ext_enumerator_list_comma
CHECK-NEXT: ext_expected_semi_decl_list
CHECK-NEXT: ext_explicit_instantiation_without_qualified_id
CHECK-NEXT: ext_explicit_specialization_storage_class
-CHECK-NEXT: ext_extra_ivar_semi
-CHECK-NEXT: ext_extra_struct_semi
CHECK-NEXT: ext_forward_ref_enum
CHECK-NEXT: ext_freestanding_complex
CHECK-NEXT: ext_hexconstant_invalid
@@ -65,7 +63,6 @@ CHECK-NEXT: ext_return_has_void_expr
CHECK-NEXT: ext_subscript_non_lvalue
CHECK-NEXT: ext_template_arg_extra_parens
CHECK-NEXT: ext_thread_before
-CHECK-NEXT: ext_top_level_semi
CHECK-NEXT: ext_typecheck_addrof_void
CHECK-NEXT: ext_typecheck_cast_nonscalar
CHECK-NEXT: ext_typecheck_cast_to_union
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index 1b3dd41ee8..75e3fbacc4 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -14,9 +14,9 @@ protected:
public:
void m() {
int l = 2;
- };
+ }; // expected-warning{{extra ';' after function definition}}
- template<typename T> void mt(T) { };
+ template<typename T> void mt(T) { }
; // expected-warning{{extra ';' inside a class}}
virtual int vf() const volatile = 0;
diff --git a/test/Parser/cxx-extra-semi.cpp b/test/Parser/cxx-extra-semi.cpp
new file mode 100644
index 0000000000..35c886b63b
--- /dev/null
+++ b/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}}
+