Commit e9546ca4 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

parse.y (check_final_variable_indirect_assignment): For COMPOUND_EXPR...

2001-09-26  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* parse.y (check_final_variable_indirect_assignment): For
	COMPOUND_EXPR, return only if finals were found initialized
	properly, if not, keep on checking.
	(check_final_variable_global_assignment_flag): New local
	error_found, set when appropriate and used to decide whether to
	report uninitialized finals. Fixed typo in comment.

( http://gcc.gnu.org/ml/gcc-patches/2001-09/msg01160.html )

From-SVN: r45844
parent 59520788
2001-09-26 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (check_final_variable_indirect_assignment): For
COMPOUND_EXPR, return only if finals were found initialized
properly, if not, keep on checking.
(check_final_variable_global_assignment_flag): New local
error_found, set when appropriate and used to decide whether to
report uninitialized finals. Fixed typo in comment.
2001-09-22 Alexandre Petit-Bianco <apbianco@redhat.com> 2001-09-22 Alexandre Petit-Bianco <apbianco@redhat.com>
* decl.c (init_decl_processing): Fixed typo in predef_filenames * decl.c (init_decl_processing): Fixed typo in predef_filenames
......
...@@ -12638,7 +12638,7 @@ check_final_variable_indirect_assignment (stmt) ...@@ -12638,7 +12638,7 @@ check_final_variable_indirect_assignment (stmt)
return check_final_variable_indirect_assignment (EXPR_WFL_NODE (stmt)); return check_final_variable_indirect_assignment (EXPR_WFL_NODE (stmt));
case COMPOUND_EXPR: case COMPOUND_EXPR:
res = check_final_variable_indirect_assignment (TREE_OPERAND (stmt, 0)); res = check_final_variable_indirect_assignment (TREE_OPERAND (stmt, 0));
if (res) if (res > 0)
return res; return res;
return check_final_variable_indirect_assignment (TREE_OPERAND (stmt, 1)); return check_final_variable_indirect_assignment (TREE_OPERAND (stmt, 1));
case SAVE_EXPR: case SAVE_EXPR:
...@@ -12679,6 +12679,7 @@ check_final_variable_global_assignment_flag (class) ...@@ -12679,6 +12679,7 @@ check_final_variable_global_assignment_flag (class)
{ {
tree field, mdecl; tree field, mdecl;
int nnctor = 0; int nnctor = 0;
int error_found = 0;
/* We go through all natural ctors and see whether they're /* We go through all natural ctors and see whether they're
initializing all their final variables or not. */ initializing all their final variables or not. */
...@@ -12700,9 +12701,12 @@ check_final_variable_global_assignment_flag (class) ...@@ -12700,9 +12701,12 @@ check_final_variable_global_assignment_flag (class)
nnctor++; nnctor++;
} }
else else
{
parse_error_context parse_error_context
(lookup_cl (mdecl), (lookup_cl (mdecl),
"Final variable initialization error in this constructor"); "Final variable initialization error in this constructor");
error_found = 1;
}
} }
else else
nnctor++; nnctor++;
...@@ -12713,9 +12717,9 @@ check_final_variable_global_assignment_flag (class) ...@@ -12713,9 +12717,9 @@ check_final_variable_global_assignment_flag (class)
if (FINAL_VARIABLE_P (field) if (FINAL_VARIABLE_P (field)
/* If the field wasn't initialized upon declaration */ /* If the field wasn't initialized upon declaration */
&& !DECL_FIELD_FINAL_IUD (field) && !DECL_FIELD_FINAL_IUD (field)
/* There wasn't natural ctor in which the field could have been /* There wasn't a natural ctor in which the field could have been
initialized */ initialized or we found an error looking for one. */
&& !nnctor && (error_found || !nnctor)
/* If we never reported a problem with this field */ /* If we never reported a problem with this field */
&& !DECL_FIELD_FINAL_IERR (field)) && !DECL_FIELD_FINAL_IERR (field))
{ {
...@@ -12725,7 +12729,6 @@ check_final_variable_global_assignment_flag (class) ...@@ -12725,7 +12729,6 @@ check_final_variable_global_assignment_flag (class)
"Final variable `%s' hasn't been initialized upon its declaration", "Final variable `%s' hasn't been initialized upon its declaration",
IDENTIFIER_POINTER (DECL_NAME (field))); IDENTIFIER_POINTER (DECL_NAME (field)));
} }
} }
/* Return 1 if an assignment to a FINAL is attempted in a non suitable /* Return 1 if an assignment to a FINAL is attempted in a non suitable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment