parse.y (expression_statement:): Call function to report improper invocation of a constructor.

Fri Oct 29 14:23:32 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (expression_statement:): Call function to report
 	improper invocation of a constructor.
	(parse_ctor_invocation_error): New function.

From-SVN: r30267
This commit is contained in:
Alexandre Petit-Bianco 1999-10-29 21:32:28 +00:00 committed by Alexandre Petit-Bianco
parent 7281a327ec
commit 8119c72007
4 changed files with 468 additions and 443 deletions

View File

@ -1,3 +1,9 @@
Fri Oct 29 14:23:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (expression_statement:): Call function to report
improper invocation of a constructor.
(parse_ctor_invocation_error): New function.
1999-10-26 Mark Mitchell <mark@codesourcery.com>
* decl.c (poplevel): Don't set BLOCK_TYPE_TAGS or call

View File

@ -427,10 +427,13 @@ add_method_1 (handle_class, access_flags, name, function_type)
if (access_flags & ACC_PUBLIC) METHOD_PUBLIC (fndecl) = 1;
if (access_flags & ACC_PROTECTED) METHOD_PROTECTED (fndecl) = 1;
if (access_flags & ACC_PRIVATE) METHOD_PRIVATE (fndecl) = 1;
if (access_flags & ACC_PRIVATE)
METHOD_PRIVATE (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_NATIVE) METHOD_NATIVE (fndecl) = 1;
if (access_flags & ACC_STATIC) METHOD_STATIC (fndecl) = 1;
if (access_flags & ACC_FINAL) METHOD_FINAL (fndecl) = 1;
if (access_flags & ACC_STATIC)
METHOD_STATIC (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_FINAL)
METHOD_FINAL (fndecl) = DECL_INLINE (fndecl) = 1;
if (access_flags & ACC_SYNCHRONIZED) METHOD_SYNCHRONIZED (fndecl) = 1;
if (access_flags & ACC_ABSTRACT) METHOD_ABSTRACT (fndecl) = 1;
if (access_flags & ACC_TRANSIENT) METHOD_TRANSIENT (fndecl) = 1;

File diff suppressed because it is too large Load Diff

View File

@ -93,6 +93,7 @@ static tree method_declarator PROTO ((tree, tree));
static void parse_warning_context PVPROTO ((tree cl, const char *msg, ...))
ATTRIBUTE_PRINTF_2;
static void issue_warning_error_from_context PROTO ((tree, const char *msg, va_list));
static void parse_ctor_invocation_error PROTO ((void));
static tree parse_jdk1_1_error PROTO ((const char *));
static void complete_class_report_errors PROTO ((jdep *));
static int process_imports PROTO ((void));
@ -1343,16 +1344,14 @@ expression_statement:
{yyerror ("')' expected"); RECOVER;}
| this_or_super OP_TK CP_TK error
{
yyerror ("Constructor invocation must be first "
"thing in a constructor");
parse_ctor_invocation_error ();
RECOVER;
}
| this_or_super OP_TK argument_list error
{yyerror ("')' expected"); RECOVER;}
| this_or_super OP_TK argument_list CP_TK error
{
yyerror ("Constructor invocation must be first "
"thing in a constructor");
parse_ctor_invocation_error ();
RECOVER;
}
| name DOT_TK SUPER_TK error
@ -2434,7 +2433,17 @@ java_pop_parser_context (generate)
free (toFree);
}
/* Reporting JDK1.1 features not implemented */
/* Reporting an constructor invocation error. */
static void
parse_ctor_invocation_error ()
{
if (DECL_CONSTRUCTOR_P (current_function_decl))
yyerror ("Constructor invocation must be first thing in a constructor");
else
yyerror ("Only constructors can invoke constructors");
}
/* Reporting JDK1.1 features not implemented. */
static tree
parse_jdk1_1_error (msg)