diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2000-08-08 03:33:36 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2000-08-07 20:33:36 -0700 |
commit | f0f3a77740016ecd1168ce689bbc36d705ddff49 (patch) | |
tree | 3231a690fb29e8d59f05640bc2d73c4114d8b28e /gcc/java/gjavah.c | |
parent | 0da9afa6d6ac1ca516bc62d97ef1b8e727ea96b7 (diff) | |
download | gcc-f0f3a77740016ecd1168ce689bbc36d705ddff49.zip gcc-f0f3a77740016ecd1168ce689bbc36d705ddff49.tar.gz gcc-f0f3a77740016ecd1168ce689bbc36d705ddff49.tar.bz2 |
2000-08-07 Alexandre Petit-Bianco <apbianco@cygnus.com
* parse.y (build_dot_class_method_invocation): Changed parameter
name to `type.' Build signature from `type' and convert it to a
STRING_CST if it's an array.
(patch_incomplete_class_ref): `build_dot_class_method_invocation'
to use `ref_type' directly.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (maybe_yank_clinit): When generating bytecode: non empty
method bodies not to rule out discarding `<clinit>'; don't use
<clinit> to initialize static fields with constant initializers.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* gjavah.c (print_method_info): Added `synth' parameter. Skip
synthetic methods.
(method_synthetic): New global.
(HANDLE_METHOD): Recognize synthetic method and tell
`print_method_info' about it.
(HANDLE_END_METHOD): Do not issue an additional `;\n' if we're
processing a synthetic method.
* jcf-reader.c (skip_attribute): New function.
( skip_attribute): Likewise.
2000-08-01 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (build_outer_field_access): Fixed comments.
(fix_constructors): Emit the initialization of this$<n> before
calling $finit$.
(resolve_qualified_expression_name): Build an access to `decl' if
necessary.
2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse-scan.y (curent_class): Non longer const.
(inner_qualifier, inner_qualifier_length): Deleted.
(current_class_length): New global.
(bracket_count): Fixed typo in leading comment.
(anonymous_count): New global.
(class_instance_creation_expression:): Handle anonymous classes.
(anonymous_class_creation:): New rule.
(push_class_context): Rewritten.
(pop_class_context): Likewise.
(INNER_QUALIFIER): Macro deleted.
(report_class_declaration): call `push_class_context' when
entering the function. `fprintf' format modified not to use
INNER_QUALIFIER.
(report_class_declaration): Assign `package_name' and
`current_class' to NULL separatly.
2000-07-31 Alexandre Petit-Bianco <apbianco@cygnus.com>
* expr.c (build_invokeinterface): Call layout_class_methods on
target interface.
(http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00339.html)
From-SVN: r35560
Diffstat (limited to 'gcc/java/gjavah.c')
-rw-r--r-- | gcc/java/gjavah.c | 70 |
1 files changed, 47 insertions, 23 deletions
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c index b8a37f7..bca748a 100644 --- a/gcc/java/gjavah.c +++ b/gcc/java/gjavah.c @@ -116,7 +116,7 @@ static struct method_name *method_name_list; static void print_field_info PARAMS ((FILE*, JCF*, int, int, JCF_u2)); static void print_mangled_classname PARAMS ((FILE*, JCF*, const char*, int)); static int print_cxx_classname PARAMS ((FILE*, const char*, JCF*, int)); -static void print_method_info PARAMS ((FILE*, JCF*, int, int, JCF_u2)); +static void print_method_info PARAMS ((FILE*, JCF*, int, int, JCF_u2, int)); static void print_c_decl PARAMS ((FILE*, JCF*, int, int, int, const char *, int)); static void print_stub_or_jni PARAMS ((FILE*, JCF*, int, int, int, @@ -182,26 +182,45 @@ static int method_pass; static int method_declared = 0; static int method_access = 0; static int method_printed = 0; -#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \ - if (method_pass) \ - { \ - decompiled = 0; method_printed = 0; \ - if (out) \ - print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \ - } \ - else \ - { \ - print_method_info (NULL, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \ - if (! stubs && ! flag_jni) \ - add_class_decl (out, jcf, SIGNATURE); \ - } - -#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ +static int method_synthetic = 0; +#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \ + { \ + method_synthetic = 0; \ + if (ATTRIBUTE_COUNT) \ + method_synthetic = peek_attribute (jcf, ATTRIBUTE_COUNT, \ + (const char *)"Synthetic", 9); \ + /* If a synthetic methods have been declared, its attribute aren't \ + worth reading (and triggering side-effects). We skip them an \ + set ATTRIBUTE_COUNT to zero so that they'll be skipped in \ + jcf_parse_one_method. */ \ + if (method_synthetic) \ + { \ + skip_attribute (jcf, ATTRIBUTE_COUNT); \ + ATTRIBUTE_COUNT = 0; \ + } \ + if (method_pass && !method_synthetic) \ + { \ + decompiled = 0; method_printed = 0; \ + if (out) \ + print_method_info (out, jcf, NAME, SIGNATURE, \ + ACCESS_FLAGS, method_synthetic); \ + } \ + else if (!method_synthetic) \ + { \ + print_method_info (NULL, jcf, NAME, SIGNATURE, \ + ACCESS_FLAGS, method_synthetic); \ + if (! stubs && ! flag_jni) \ + add_class_decl (out, jcf, SIGNATURE); \ + } \ + } + +#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH); static int decompiled = 0; -#define HANDLE_END_METHOD() \ - if (out && method_printed) fputs (decompiled || stubs ? "\n" : ";\n", out); +#define HANDLE_END_METHOD() \ + if (out && method_printed && !method_synthetic) \ + fputs (decompiled || stubs ? "\n" : ";\n", out); #include "jcf-reader.c" @@ -670,9 +689,9 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags), static void -DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags), +DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags, synth), FILE *stream AND JCF* jcf - AND int name_index AND int sig_index AND JCF_u2 flags) + AND int name_index AND int sig_index AND JCF_u2 flags AND int synth) { const unsigned char *str; int length, is_init = 0; @@ -684,10 +703,15 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags), fprintf (stream, "<not a UTF8 constant>"); str = JPOOL_UTF_DATA (jcf, name_index); length = JPOOL_UTF_LENGTH (jcf, name_index); - if (str[0] == '<' || str[0] == '$') + + /* Ignore synthetic methods. */ + if (synth) + return; + + if (str[0] == '<') { - /* Ignore internally generated methods like <clinit> and - $finit$. However, treat <init> as a constructor. */ + /* Ignore the internally generated method <clinit>. However, + treat <init> as a constructor. */ if (! utf8_cmp (str, length, "<init>")) is_init = 1; else if (! METHOD_IS_FINAL (jcf->access_flags, flags) |