diff options
author | Alexandre Petit-Bianco <apbianco@redhat.com> | 2001-07-05 15:33:44 -0700 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2001-07-05 15:33:44 -0700 |
commit | 51e23701494811dd20ed2cf1d6e4c5299d5d24d4 (patch) | |
tree | c27ae8ff81e650632f11ca9a8fc6aa5dade53668 | |
parent | 43a727554dae9550dbd823af097964fef4aaa265 (diff) | |
download | gcc-51e23701494811dd20ed2cf1d6e4c5299d5d24d4.zip gcc-51e23701494811dd20ed2cf1d6e4c5299d5d24d4.tar.gz gcc-51e23701494811dd20ed2cf1d6e4c5299d5d24d4.tar.bz2 |
[multiple changes]
2001-07-03 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (resolve_expression_name): Improved error message for
inner class cases.
Fixes PR java/1958
2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
* jcf-parse.c (gcc_mark_jcf): Test for a finished JCF.
* jcf.h (typedef struct JCF): New bitfield `finished.'
(JCF_FINISH): Set `finished.'
(JCF_ZERO): Reset `finished.'
Fixes PR java/2633
2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (class_body_declaration:): Don't install empty instance
initializers.
Fixes PR java/1314
(http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00321.html )
From-SVN: r43793
-rw-r--r-- | gcc/java/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 5 | ||||
-rw-r--r-- | gcc/java/jcf.h | 7 | ||||
-rw-r--r-- | gcc/java/parse.y | 18 |
4 files changed, 42 insertions, 8 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 6a73085..28888f2 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -14,6 +14,12 @@ * parse.y (fix_constructors): Test if a CALL_EXPR invokes `this'. If so, don't build instance initializers. +2001-07-03 Alexandre Petit-Bianco <apbianco@redhat.com> + + * parse.y (resolve_expression_name): Improved error message for + inner class cases. + Fixes PR java/1958 + 2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com> * lang.c: #include diagnostic.h @@ -23,6 +29,20 @@ 2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com> + * jcf-parse.c (gcc_mark_jcf): Test for a finished JCF. + * jcf.h (typedef struct JCF): New bitfield `finished.' + (JCF_FINISH): Set `finished.' + (JCF_ZERO): Reset `finished.' + Fixes PR java/2633 + +2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com> + + * parse.y (class_body_declaration:): Don't install empty instance + initializers. + Fixes PR java/1314 + +2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com> + * class.c (set_super_info): Call `set_class_decl_access_flags.' (set_class_decl_access_flags): New function. * java-tree.h (set_class_decl_access_flags): New prototype. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index b4d5ba0..d925205 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -101,14 +101,15 @@ static void jcf_parse PARAMS ((struct JCF*)); static void load_inner_classes PARAMS ((tree)); /* Mark (for garbage collection) all the tree nodes that are - referenced from JCF's constant pool table. */ + referenced from JCF's constant pool table. Do that only if the JCF + hasn't been marked finished. */ static void ggc_mark_jcf (elt) void **elt; { JCF *jcf = *(JCF**) elt; - if (jcf != NULL) + if (jcf != NULL && !jcf->finished) { CPool *cpool = &jcf->cpool; int size = CPOOL_COUNT(cpool); diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h index 4586f06..fc3cedf 100644 --- a/gcc/java/jcf.h +++ b/gcc/java/jcf.h @@ -90,6 +90,7 @@ typedef struct JCF { unsigned char *read_end; int java_source : 1; int right_zip : 1; + int finished : 1; jcf_filbuf_t filbuf; void *read_state; const char *filename; @@ -144,7 +145,8 @@ typedef struct JCF { CPOOL_FINISH(&(JCF)->cpool); \ if ((JCF)->buffer) FREE ((JCF)->buffer); \ if ((JCF)->filename) FREE ((char *) (JCF)->filename); \ - if ((JCF)->classname) FREE ((char *) (JCF)->classname); } + if ((JCF)->classname) FREE ((char *) (JCF)->classname); \ + (JCF)->finished = 1; } #define CPOOL_INIT(CPOOL) \ ((CPOOL)->capacity = 0, (CPOOL)->count = 0, (CPOOL)->tags = 0, (CPOOL)->data = 0) @@ -154,7 +156,8 @@ typedef struct JCF { #define JCF_ZERO(JCF) \ ((JCF)->buffer = (JCF)->buffer_end = (JCF)->read_ptr = (JCF)->read_end = 0,\ (JCF)->read_state = 0, (JCF)->filename = (JCF)->classname = 0, \ - CPOOL_INIT(&(JCF)->cpool), (JCF)->java_source = 0, (JCF)->zipd = 0) + CPOOL_INIT(&(JCF)->cpool), (JCF)->java_source = 0, (JCF)->zipd = 0, \ + (JCF)->finished = 0) /* Given that PTR points to a 2-byte unsigned integer in network (big-endian) byte-order, return that integer. */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index ac062ad..e4e682b 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -924,8 +924,11 @@ class_body_declaration: | constructor_declaration | block /* Added, JDK1.1, instance initializer */ { - TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp); - SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1); + if ($1 != empty_stmt_node) + { + TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp); + SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1); + } } ; @@ -8952,8 +8955,15 @@ resolve_expression_name (id, orig) } /* We've got an error here */ - parse_error_context (id, "Undefined variable `%s'", - IDENTIFIER_POINTER (name)); + if (INNER_CLASS_TYPE_P (current_class)) + parse_error_context (id, + "Local variable `%s' can't be accessed from within the inner class `%s' unless it is declared final", + IDENTIFIER_POINTER (name), + IDENTIFIER_POINTER (DECL_NAME + (TYPE_NAME (current_class)))); + else + parse_error_context (id, "Undefined variable `%s'", + IDENTIFIER_POINTER (name)); return error_mark_node; } |