mirror of git://gcc.gnu.org/git/gcc.git
c.opt (Wextra-semi): New C++ warning flag.
* c.opt (Wextra-semi): New C++ warning flag.
* doc/invoke.texi (-Wextra-semi): Document new warning option.
* parser.c (cp_parser_member_declaration): Add warning with fixit
information for extra semicolon after in-class function definition.
* g++.dg/warn/Wextra-semi.C: New test.
From-SVN: r247028
This commit is contained in:
parent
4ba07ed462
commit
c3cbcd4517
|
|
@ -1,3 +1,7 @@
|
|||
2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
* doc/invoke.texi (-Wextra-semi): Document new warning option.
|
||||
|
||||
2017-04-20 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/57796
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
* c.opt (Wextra-semi): New C++ warning flag.
|
||||
|
||||
2017-04-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/80423
|
||||
|
|
|
|||
|
|
@ -504,6 +504,10 @@ Wextra
|
|||
C ObjC C++ ObjC++ Warning
|
||||
; in common.opt
|
||||
|
||||
Wextra-semi
|
||||
C++ ObjC++ Var(warn_extra_semi) Warning
|
||||
Warn about semicolon after in-class function definition.
|
||||
|
||||
Wfloat-conversion
|
||||
C ObjC C++ ObjC++ Var(warn_float_conversion) Warning LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
|
||||
Warn for implicit type conversions that cause loss of floating point precision.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
* parser.c (cp_parser_member_declaration): Add warning with fixit
|
||||
information for extra semicolon after in-class function definition.
|
||||
|
||||
2017-04-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/80423
|
||||
|
|
|
|||
|
|
@ -23386,7 +23386,15 @@ cp_parser_member_declaration (cp_parser* parser)
|
|||
token = cp_lexer_peek_token (parser->lexer);
|
||||
/* If the next token is a semicolon, consume it. */
|
||||
if (token->type == CPP_SEMICOLON)
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
{
|
||||
location_t semicolon_loc
|
||||
= cp_lexer_consume_token (parser->lexer)->location;
|
||||
gcc_rich_location richloc (semicolon_loc);
|
||||
richloc.add_fixit_remove ();
|
||||
warning_at_rich_loc (&richloc, OPT_Wextra_semi,
|
||||
"extra %<;%> after in-class "
|
||||
"function definition");
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -274,7 +274,8 @@ Objective-C and Objective-C++ Dialects}.
|
|||
-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
|
||||
-Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
|
||||
-Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
|
||||
-Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
|
||||
-Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
|
||||
-Wfloat-equal -Wformat -Wformat=2 @gol
|
||||
-Wno-format-contains-nul -Wno-format-extra-args @gol
|
||||
-Wformat-nonliteral -Wformat-overflow=@var{n} @gol
|
||||
-Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
|
||||
|
|
@ -5960,6 +5961,11 @@ In C++ enumerated type mismatches in conditional expressions are also
|
|||
diagnosed and the warning is enabled by default. In C this warning is
|
||||
enabled by @option{-Wall}.
|
||||
|
||||
@item -Wextra-semi @r{(C++, Objective-C++ only)}
|
||||
@opindex Wextra-semi
|
||||
@opindex Wno-extra-semi
|
||||
Warn about redundant semicolon after in-class function definition.
|
||||
|
||||
@item -Wjump-misses-init @r{(C, Objective-C only)}
|
||||
@opindex Wjump-misses-init
|
||||
@opindex Wno-jump-misses-init
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
2017-04-20 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
* g++.dg/warn/Wextra-semi.C: New test.
|
||||
|
||||
2017-04-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/80423
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-Wextra-semi -fdiagnostics-show-caret" }
|
||||
|
||||
struct A
|
||||
{
|
||||
A() {}; /* { dg-warning "after in-class function definition" }
|
||||
{ dg-begin-multiline-output "" }
|
||||
A() {};
|
||||
^
|
||||
-
|
||||
{ dg-end-multiline-output "" } */
|
||||
|
||||
void foo() {}; /* { dg-warning "after in-class function definition" }
|
||||
{ dg-begin-multiline-output "" }
|
||||
void foo() {};
|
||||
^
|
||||
-
|
||||
{ dg-end-multiline-output "" } */
|
||||
|
||||
friend void bar() {}; /* { dg-warning "after in-class function definition" }
|
||||
{ dg-begin-multiline-output "" }
|
||||
friend void bar() {};
|
||||
^
|
||||
-
|
||||
{ dg-end-multiline-output "" } */
|
||||
};
|
||||
Loading…
Reference in New Issue