diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-04 21:50:31 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-04 21:50:31 +0000 |
commit | 44bc851ac3c4fe4c0114cb5bf1f6f801964cd6f5 (patch) | |
tree | 3aa4d589e9f930024d5f2e721aeee96095bdd21b /gcc/java/parse.y | |
parent | 6463b7ae2f97909ba86a78ec9523d34cd8a971c4 (diff) | |
download | gcc-44bc851ac3c4fe4c0114cb5bf1f6f801964cd6f5.tar.gz |
* parse.y (maybe_yank_clinit): A field without an initializer is not
relevant. All initializers except static final and constant require
<clinit>, regardless of flag_emit_class_files.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45388 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r-- | gcc/java/parse.y | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 09a4dcd6ce0..698f42274e8 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -7862,6 +7862,12 @@ maybe_yank_clinit (mdecl) if (!FIELD_STATIC (current)) continue; + /* nor in fields with initializers. */ + f_init = DECL_INITIAL (current); + + if (f_init == NULL_TREE) + continue; + /* Anything that isn't String or a basic type is ruled out -- or if we know how to deal with it (when doing things natively) we should generated an empty <clinit> so that SUID are computed @@ -7869,18 +7875,8 @@ maybe_yank_clinit (mdecl) if (! JSTRING_TYPE_P (TREE_TYPE (current)) && ! JNUMERIC_TYPE_P (TREE_TYPE (current))) break; - - f_init = DECL_INITIAL (current); - /* If we're emitting native code, we want static final fields to - have constant initializers. If we don't meet these - conditions, we keep <clinit> */ - if (!flag_emit_class_files - && !(FIELD_FINAL (current) && f_init && TREE_CONSTANT (f_init))) - break; - /* If we're emitting bytecode, we want static fields to have - constant initializers or no initializer. If we don't meet - these conditions, we keep <clinit> */ - if (flag_emit_class_files && f_init && !TREE_CONSTANT (f_init)) + + if (! FIELD_FINAL (current) || ! TREE_CONSTANT (f_init)) break; } |