aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>2000-09-29 20:14:53 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2000-09-29 13:14:53 -0700
commit99eaf8d457598be158a5d4f79fe8e9655e74b6b8 (patch)
tree8f7b156304d9631af57eecd52522716b8769f46c /gcc/java
parenta1c63101c48412ffcac56f9c4bb32383f86c3c32 (diff)
downloadgcc-99eaf8d457598be158a5d4f79fe8e9655e74b6b8.zip
gcc-99eaf8d457598be158a5d4f79fe8e9655e74b6b8.tar.gz
gcc-99eaf8d457598be158a5d4f79fe8e9655e74b6b8.tar.bz2
parse.y (maybe_yank_clinit): Also keep <clinit> if its body contains something else than MODIFY_EXPR.
2000-09-29 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (maybe_yank_clinit): Also keep <clinit> if its body contains something else than MODIFY_EXPR. (http://gcc.gnu.org/ml/gcc-patches/2000-09/msg01141.html) From-SVN: r36670
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/parse.y31
2 files changed, 35 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 83c5648..632707b 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-29 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * parse.y (maybe_yank_clinit): Also keep <clinit> if its body
+ contains something else than MODIFY_EXPR.
+
2000-09-23 Mark Mitchell <mark@codesourcery.com>
* Make-lang.in (JAVA_SRCS): Include java-tree.h.
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index b1a8e15..e6aeb32 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -7599,6 +7599,7 @@ maybe_yank_clinit (mdecl)
{
tree type, current;
tree fbody, bbody;
+ int found = 0;
if (!DECL_CLINIT_P (mdecl))
return 0;
@@ -7646,7 +7647,35 @@ maybe_yank_clinit (mdecl)
break;
}
- if (current)
+ /* Now we analyze the method body and look for something that
+ isn't a MODIFY_EXPR */
+ if (bbody == empty_stmt_node)
+ bbody = NULL_TREE;
+ while (bbody)
+ switch (TREE_CODE (bbody))
+ {
+ case BLOCK:
+ bbody = BLOCK_EXPR_BODY (bbody);
+ break;
+
+ case EXPR_WITH_FILE_LOCATION:
+ bbody = EXPR_WFL_NODE (bbody);
+ break;
+
+ case COMPOUND_EXPR:
+ bbody = TREE_OPERAND (bbody, 0);
+ break;
+
+ case MODIFY_EXPR:
+ bbody = NULL_TREE;
+ break;
+
+ default:
+ bbody = NULL_TREE;
+ found = 1;
+ }
+
+ if (current || found)
return 0;
/* Get rid of <clinit> in the class' list of methods */