diff options
author | Richard Trieu <rtrieu@google.com> | 2012-05-16 19:04:59 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2012-05-16 19:04:59 +0000 |
commit | 2f7dc46a5868db54f5a96e3a7308cad6970c0e4b (patch) | |
tree | e6c0a659e4d59be74b1b89330ea5f7228797b616 /clang/test | |
parent | 8c17fbd6c167687fca630b91ba007265e6a9c424 (diff) | |
download | bcm5719-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')
-rw-r--r-- | clang/test/Misc/warning-flags.c | 5 | ||||
-rw-r--r-- | clang/test/Parser/cxx-class.cpp | 4 | ||||
-rw-r--r-- | clang/test/Parser/cxx-extra-semi.cpp | 25 |
3 files changed, 28 insertions, 6 deletions
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index e8995176193..98130c5e27a 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/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/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp index 1b3dd41ee82..75e3fbacc46 100644 --- a/clang/test/Parser/cxx-class.cpp +++ b/clang/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/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}} + |