diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-14 11:25:19 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-14 11:25:19 +0000 |
commit | a918f0ded0a4aa76d0b0d5e00f1688ffd9ce09da (patch) | |
tree | a295404c16f11a6d0ee61912810574c8b388f99e /gcc/java/gjavah.c | |
parent | b0595e62261e1807f31e6dfd6bab1035c8101811 (diff) | |
download | gcc-a918f0ded0a4aa76d0b0d5e00f1688ffd9ce09da.tar.gz |
* gjavah.c (decompile_method): Decompile `return null'.
(process_file): Generate `#pragma interface'.
(method_declared): New global.
(print_method_info): Set it.
(HANDLE_CODE_ATTRIBUTE): Only print it method_declared set.
(print_method_info): Handle abstract methods.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24309 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/gjavah.c')
-rw-r--r-- | gcc/java/gjavah.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c index 5e879c75469..8fa0d0eb738 100644 --- a/gcc/java/gjavah.c +++ b/gcc/java/gjavah.c @@ -124,6 +124,7 @@ static int field_pass; #define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX) +static int method_declared = 0; static int method_access = 0; #define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \ if (out) { decompiled = 0; \ @@ -131,7 +132,7 @@ static int method_access = 0; } #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ - if (out) decompile_method (out, jcf, CODE_LENGTH); + if (out && method_declared) decompile_method (out, jcf, CODE_LENGTH); static int decompiled = 0; #define HANDLE_END_METHOD() \ @@ -399,6 +400,7 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags), int length, is_init = 0; char *override = NULL; + method_declared = 0; method_access = flags; if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8) fprintf (stream, "<not a UTF8 constant>"); @@ -453,6 +455,11 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags), fputs ("virtual ", out); } print_c_decl (out, jcf, name_index, sig_index, flags, is_init, override); + + if ((flags & ACC_ABSTRACT)) + fputs (" = 0", out); + else + method_declared = 1; } /* Try to decompile a method body. Right now we just try to handle a @@ -506,6 +513,15 @@ decompile_method (out, jcf, code_len) fputs (" { }", out); decompiled = 1; } + else if (code_len == 2 + && codes[0] == OPCODE_aconst_null + && codes[1] == OPCODE_areturn) + { + /* Found `return null'. We don't want to depend on NULL being + defined. */ + fputs (" { return 0; }", out); + decompiled = 1; + } } /* Print one piece of a signature. Returns pointer to next parseable @@ -833,6 +849,11 @@ DEFUN(process_file, (jcf, out), print_mangled_classname (out, jcf, "#define __", jcf->this_class); fprintf (out, "__\n\n"); + + /* We do this to ensure that inline methods won't be `outlined' + by g++. This works as long as method and fields are not + added by the user. */ + fprintf (out, "#pragma interface\n\n"); } if (jcf->super_class && out) |