mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-08 20:27:48 +08:00
java-tree.h (flag_extraneous_semicolon): New extern.
2000-08-08 Alexandre Petit-Bianco <apbianco@cygnus.com> * java-tree.h (flag_extraneous_semicolon): New extern. * lang-options.h: (-Wextraneous-semicolon): New option. * lang.c (flag_redundant): Fixed typo in leading comment. (flag_extraneous_semicolon): New global. (lang_decode_option): Set `flag_extraneous_semicolon' when -Wall. Decode `-Wextraneous-semicolon'. * parse.y (type_declaration:): Removed `SC_TK' hack, added `empty_statement' rule. (class_body_declaration): Likewise. (method_body:): Accept `;' as a method body. (static_initializer:): Removed `SC_TK' hack. (constructor_block_end:): Likewise. (empty_statement:): Report deprecated empty declaration. Fixes gcj/295 (Fix to gcj/295: http://sources.redhat.com/ml/java-prs/2000-q3/msg00095.html) From-SVN: r35929
This commit is contained in:
parent
e15a68e7bc
commit
5f1c312aa0
@ -66,6 +66,23 @@ Sun Aug 13 09:41:49 2000 Anthony Green <green@redhat.com>
|
||||
`case' statement.
|
||||
(patch_assignment): Set DECL_INITIAL on integral final local.
|
||||
|
||||
2000-08-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* java-tree.h (flag_extraneous_semicolon): New extern.
|
||||
* lang-options.h: (-Wextraneous-semicolon): New option.
|
||||
* lang.c (flag_redundant): Fixed typo in leading comment.
|
||||
(flag_extraneous_semicolon): New global.
|
||||
(lang_decode_option): Set `flag_extraneous_semicolon' when
|
||||
-Wall. Decode `-Wextraneous-semicolon'.
|
||||
* parse.y (type_declaration:): Removed `SC_TK' hack, added
|
||||
`empty_statement' rule.
|
||||
(class_body_declaration): Likewise.
|
||||
(method_body:): Accept `;' as a method body.
|
||||
(static_initializer:): Removed `SC_TK' hack.
|
||||
(constructor_block_end:): Likewise.
|
||||
(empty_statement:): Report deprecated empty declaration. Fixes
|
||||
gcj/295
|
||||
|
||||
2000-08-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
|
||||
|
||||
* parse.y (build_dot_class_method_invocation): Changed parameter
|
||||
|
@ -141,6 +141,10 @@ extern int flag_emit_class_files;
|
||||
|
||||
extern int flag_jni;
|
||||
|
||||
/* When non zero, report the now deprecated empty statements. */
|
||||
|
||||
extern int flag_extraneous_semicolon;
|
||||
|
||||
/* When non zero, we emit xref strings. Values of the flag for xref
|
||||
backends are defined in xref.h. */
|
||||
|
||||
|
@ -51,3 +51,4 @@ DEFINE_LANG_NAME ("Java")
|
||||
{ "-Wredundant-modifiers",
|
||||
"Warn if modifiers are specified when not necessary"},
|
||||
{ "-Wunsupported-jdk11", "Warn if `final' local variables are specified"},
|
||||
{ "-Wextraneous-semicolon", "Warn if deprecated empty statements are found"},
|
||||
|
@ -98,7 +98,7 @@ int flag_emit_xref = 0;
|
||||
/* When non zero, -Wall was turned on. */
|
||||
int flag_wall = 0;
|
||||
|
||||
/* When non zero, check for redundant modifier uses. */
|
||||
/* When non zero, check for redundant modifier uses. */
|
||||
int flag_redundant = 0;
|
||||
|
||||
/* When non zero, warns about overridings that don't occur. */
|
||||
@ -121,6 +121,9 @@ int flag_hash_synchronization;
|
||||
JNI, not CNI. */
|
||||
int flag_jni = 0;
|
||||
|
||||
/* When non zero, report the now deprecated empty statements. */
|
||||
int flag_extraneous_semicolon;
|
||||
|
||||
/* From gcc/flags.h, and indicates if exceptions are turned on or not. */
|
||||
|
||||
extern int flag_new_exceptions;
|
||||
@ -256,6 +259,7 @@ lang_decode_option (argc, argv)
|
||||
{
|
||||
flag_wall = 1;
|
||||
flag_redundant = 1;
|
||||
flag_extraneous_semicolon = 1;
|
||||
/* When -Wall given, enable -Wunused. We do this because the C
|
||||
compiler does it, and people expect it. */
|
||||
set_Wunused (1);
|
||||
@ -274,6 +278,12 @@ lang_decode_option (argc, argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp (p, "-Wextraneous-semicolon") == 0)
|
||||
{
|
||||
flag_extraneous_semicolon = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp (p, "-MD") == 0)
|
||||
{
|
||||
jcf_dependency_init (1);
|
||||
|
@ -755,8 +755,7 @@ type_declaration:
|
||||
{ end_class_declaration (0); }
|
||||
| interface_declaration
|
||||
{ end_class_declaration (0); }
|
||||
| SC_TK
|
||||
{ $$ = NULL; }
|
||||
| empty_statement
|
||||
| error
|
||||
{
|
||||
YYERROR_NOW;
|
||||
@ -880,13 +879,12 @@ class_body_declaration:
|
||||
|
||||
class_member_declaration:
|
||||
field_declaration
|
||||
| field_declaration SC_TK
|
||||
{ $$ = $1; }
|
||||
| method_declaration
|
||||
| class_declaration /* Added, JDK1.1 inner classes */
|
||||
{ end_class_declaration (1); }
|
||||
| interface_declaration /* Added, JDK1.1 inner interfaces */
|
||||
{ end_class_declaration (1); }
|
||||
| empty_statement
|
||||
;
|
||||
|
||||
/* 19.8.2 Productions from 8.3: Field Declarations */
|
||||
@ -1085,9 +1083,7 @@ class_type_list:
|
||||
|
||||
method_body:
|
||||
block
|
||||
| block SC_TK
|
||||
| SC_TK
|
||||
{ $$ = NULL_TREE; } /* Probably not the right thing to do. */
|
||||
| SC_TK { $$ = NULL_TREE; }
|
||||
;
|
||||
|
||||
/* 19.8.4 Productions from 8.5: Static Initializers */
|
||||
@ -1097,11 +1093,6 @@ static_initializer:
|
||||
TREE_CHAIN ($2) = CPC_STATIC_INITIALIZER_STMT (ctxp);
|
||||
SET_CPC_STATIC_INITIALIZER_STMT (ctxp, $2);
|
||||
}
|
||||
| static block SC_TK /* Shouldn't be here. FIXME */
|
||||
{
|
||||
TREE_CHAIN ($2) = CPC_STATIC_INITIALIZER_STMT (ctxp);
|
||||
SET_CPC_STATIC_INITIALIZER_STMT (ctxp, $2);
|
||||
}
|
||||
;
|
||||
|
||||
static: /* Test lval.sub_token here */
|
||||
@ -1166,7 +1157,7 @@ constructor_body:
|
||||
|
||||
constructor_block_end:
|
||||
block_end
|
||||
| block_end SC_TK
|
||||
;
|
||||
|
||||
/* Error recovery for that rule moved down expression_statement: rule. */
|
||||
explicit_constructor_invocation:
|
||||
@ -1397,7 +1388,14 @@ statement_without_trailing_substatement:
|
||||
|
||||
empty_statement:
|
||||
SC_TK
|
||||
{ $$ = empty_stmt_node; }
|
||||
{
|
||||
if (flag_extraneous_semicolon)
|
||||
{
|
||||
EXPR_WFL_SET_LINECOL (wfl_operator, lineno, -1);
|
||||
parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
|
||||
}
|
||||
$$ = empty_stmt_node;
|
||||
}
|
||||
;
|
||||
|
||||
label_decl:
|
||||
|
Loading…
Reference in New Issue
Block a user