aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2004-05-29 05:11:41 +0000
committerRanjit Mathew <rmathew@gcc.gnu.org>2004-05-29 05:11:41 +0000
commitedf74484b2277d89da3d02da5ed694fd6fb0716f (patch)
treefa7c6c430b62609bd2e6979cf8f506515595ec7f /gcc/java/parse.y
parent27e1a8d2eebf19730394a178567c775dd39ac248 (diff)
downloadgcc-edf74484b2277d89da3d02da5ed694fd6fb0716f.zip
gcc-edf74484b2277d89da3d02da5ed694fd6fb0716f.tar.gz
gcc-edf74484b2277d89da3d02da5ed694fd6fb0716f.tar.bz2
java-tree.h (DECL_LOCAL_FINAL_IUD): New macro to test if a local variable was initialised upon declaration.
* java-tree.h (DECL_LOCAL_FINAL_IUD): New macro to test if a local variable was initialised upon declaration. * parse.y (declare_local_variables): Set DECL_LOCAL_FINAL_IUD if variable was final and initialised upon declaration. * check-init.c (check_final_reassigned): Give error only if a blank final is not definitely unassigned or if an initialised final is reassigned. (check_bool_init): Respect JLS2 16.1.7 requirements for boolean assignment expressions. Remove case MODIFY_EXPR, label do_default. (check_init): Perform initialised-variable-removing-optimisation only on non-final local variables. Co-Authored-By: Per Bothner <per@bothner.com> From-SVN: r82416
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index d6c597f..65bd091 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -7375,6 +7375,13 @@ declare_local_variables (int modifier, tree type, tree vlist)
if (init && java_error_count)
init = NULL_TREE;
+ /* Remember it if this is an initialized-upon-declaration final
+ variable. */
+ if (init && final_p)
+ {
+ DECL_LOCAL_FINAL_IUD (decl) = 1;
+ }
+
/* Add the initialization function to the current function's code */
if (init)
{