diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-23 05:45:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-23 05:45:25 +0000 |
commit | eab9d6f9065b042d39fbaf9842c9d8cc968dd6d0 (patch) | |
tree | ae1948b1996d0c59ea4f597701504ea5e8caa25c /include/clang | |
parent | 3fe52ff7df93f7a928a15cc2cbf5134fdc0cec15 (diff) |
Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160618 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 19 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 6 |
3 files changed, 20 insertions, 9 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 10affb07d3..8811e6aa36 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -62,6 +62,8 @@ def DocumentationPedantic : DiagGroup<"documentation-pedantic">; def Documentation : DiagGroup<"documentation", [DocumentationHTML]>; def EmptyBody : DiagGroup<"empty-body">; def ExtraTokens : DiagGroup<"extra-tokens">; +def CXX11ExtraSemi : DiagGroup<"c++11-extra-semi">; +def ExtraSemi : DiagGroup<"extra-semi", [CXX11ExtraSemi]>; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; @@ -404,7 +406,7 @@ def NonGCC : DiagGroup<"non-gcc", // A warning group for warnings about using C++11 features as extensions in // earlier C++ versions. -def CXX11 : DiagGroup<"c++11-extensions">; +def CXX11 : DiagGroup<"c++11-extensions", [CXX11ExtraSemi]>; def : DiagGroup<"c++0x-extensions", [CXX11]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index ae3f3a6a15..31b8077ef3 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -31,8 +31,14 @@ def ext_extra_semi : Extension< "outside of a function|" "inside a %1|" "inside instance variable list|" - "after function definition}0">, - InGroup<DiagGroup<"extra-semi">>; + "after member function definition}0">, + InGroup<ExtraSemi>; +def ext_extra_semi_cxx11 : Extension< + "extra ';' outside of a function is a C++11 extension">, + InGroup<CXX11ExtraSemi>; +def warn_extra_semi_after_mem_fn_def : Warning< + "extra ';' after member function definition">, + InGroup<ExtraSemi>, DefaultIgnore; def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">; def ext_plain_complex : ExtWarn< @@ -61,9 +67,12 @@ def ext_c99_compound_literal : Extension< "compound literals are a C99-specific feature">, InGroup<C99>; def ext_c99_flexible_array_member : Extension< "Flexible array members are a C99-specific feature">, InGroup<C99>; -def ext_enumerator_list_comma : Extension< - "commas at the end of enumerator lists are a %select{C99|C++11}0-specific " - "feature">; +def ext_enumerator_list_comma_c : Extension< + "commas at the end of enumerator lists are a C99-specific " + "feature">, InGroup<C99>; +def ext_enumerator_list_comma_cxx : Extension< + "commas at the end of enumerator lists are a C++11 extension">, + InGroup<CXX11>; def warn_cxx98_compat_enumerator_list_comma : Warning< "commas at the end of enumerator lists are incompatible with C++98">, InGroup<CXX98CompatPedantic>, DefaultIgnore; diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 14ae6604b2..ca380463fb 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -596,16 +596,16 @@ private: /// to the semicolon, consumes that extra token. bool ExpectAndConsumeSemi(unsigned DiagID); - /// \brief The kind of extra semi diagnostic to emit. + /// \brief The kind of extra semi diagnostic to emit. enum ExtraSemiKind { OutsideFunction = 0, InsideStruct = 1, InstanceVariableList = 2, - AfterDefinition = 3 + AfterMemberFunctionDefinition = 3 }; /// \brief Consume any extra semi-colons until the end of the line. - void ConsumeExtraSemi(ExtraSemiKind Kind, const char* DiagMsg = ""); + void ConsumeExtraSemi(ExtraSemiKind Kind, unsigned TST = TST_unspecified); //===--------------------------------------------------------------------===// // Scope manipulation |