From: Ted Kremenek Date: Tue, 10 Nov 2009 22:16:29 +0000 (+0000) Subject: Make -Wsemicolon-before-method-body opt-in (and part of -Wextra). Addresses . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86731 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 1280062d79..ae3f0ef7ec 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -69,6 +69,7 @@ def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; def ReturnType : DiagGroup<"return-type">; def : DiagGroup<"sequence-point">; +def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">; def : DiagGroup<"shadow">; def : DiagGroup<"shorten-64-to-32">; def SignCompare : DiagGroup<"sign-compare">; @@ -133,8 +134,8 @@ def FormatY2K : DiagGroup<"format-y2k", [Format]>; def Format2 : DiagGroup<"format=2", [FormatNonLiteral, FormatSecurity, FormatY2K]>; - def Extra : DiagGroup<"extra", [ + SemiBeforeMethodBody, SignCompare, UnusedParameter ]>; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 2d5a502bfe..036d887865 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -201,9 +201,9 @@ def warn_expected_implementation : Warning< "@end must appear in an @implementation context">; def error_property_ivar_decl : Error< "property synthesize requires specification of an ivar">; -def warn_semicolon_before_method_nody : Warning< +def warn_semicolon_before_method_body : Warning< "semicolon before method body is ignored">, - InGroup>; + InGroup>, DefaultIgnore; def err_expected_field_designator : Error< "expected a field designator, such as '.field = 4'">; diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index d06d8b6e9c..478bdcbff7 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1410,7 +1410,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() { // parse optional ';' if (Tok.is(tok::semi)) { if (ObjCImpDecl) - Diag(Tok, diag::warn_semicolon_before_method_nody); + Diag(Tok, diag::warn_semicolon_before_method_body); ConsumeToken(); } diff --git a/test/SemaObjC/objc-string-constant.m b/test/SemaObjC/objc-string-constant.m index d27a46a966..c6461dd1c2 100644 --- a/test/SemaObjC/objc-string-constant.m +++ b/test/SemaObjC/objc-string-constant.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -verify -fsyntax-only +// RUN: clang-cc -Wsemicolon-before-method-body %s -verify -fsyntax-only #define nil 0 /* id of Nil instance */