summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-03-21 06:09:25 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-03-21 06:09:25 +0000
commit003019ba638bced0acb0d372946849e6a5935d1a (patch)
tree9f1d36a20bdefbffdac55462d09c82614184fc52
parentb84a11fa383196373e5daf3e855ad460ad641572 (diff)
downloadgcc-003019ba638bced0acb0d372946849e6a5935d1a.tar.gz
* Makefile.in (jcf-dump.o): Depend on $(CONFIG_H)
$(srcdir)/../system.h and $(JAVA_TREE_H). (jcf-io.o): Depend on $(JAVA_TREE_H). (mangle.o): Likewise. * check-init.c (check_cond_init): Add static prototype. * class.c (build_java_method_type, hashUtf8String, make_field_value, get_dispatch_vector, get_dispatch_table, append_gpp_mangled_type, mangle_static_field): Likewise. (strLengthUtf8): Hide unused definition. (hashUtf8String): Const-ify. (make_field_value): Un-ANSI-fy. * constants.c: Move inclusion of jcf.h above java-tree.h. (set_constant_entry, find_class_or_string_constant, find_name_and_type_constant, get_tag_node, build_constant_data_ref): Add static prototype. * decl.c (push_jvm_slot, builtin_function, lookup_name_current_level): Likewise. (builtin_function): Const-ify. * except.c (expand_start_java_handler, expand_end_java_handler): Add static prototype. * expr.c (flush_quick_stack, push_value, pop_value, java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr, build_java_ret, expand_java_multianewarray, expand_java_arraystore, expand_java_arrayload, expand_java_array_length, build_java_monitor, expand_java_pushc, expand_java_return, expand_java_NEW, expand_java_INSTANCEOF, expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label, expand_compare, expand_test, expand_cond, expand_java_goto, expand_java_call, expand_java_ret, pop_arguments, expand_invoke, expand_java_field_op, java_push_constant_from_pool): Likewise. (decode_newarray_type, expand_iinc): Un-ANSI-fy. (build_java_arraynull_check): Mark parameters `node' and `type' with ATTRIBUTE_UNUSED. (note_label): Likewise for parameter `current_pc'. (expand_java_call, expand_java_ret): Hide unused definition. * java-tree.h (make_class, build_constants_constructor, java_set_exception_lang_code, pop_labeled_block, emit_handlers, init_outgoing_cpool, register_class, emit_register_classes, java_layout_seen_class_methods): Prototype. (unicode_mangling_length): Const-ify. (append_gpp_mangled_name, append_gpp_mangled_classtype, emit_unicode_mangled_name, format_int, format_uint, jcf_trim_old_input, jcf_print_utf8, jcf_print_char, jcf_print_utf8_replace, open_class): Prototype. * jcf-dump.c: Include "config.h", not <config.h>. Don't include <stdio.h>. Include tree.h/java-tree.h. (utf8_equal_string usage, process_class): Add static prototype. (open_class): Don't prototype this here. (utf8_equal_string): Match arguments to format specifiers. (HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH, TABLE_SWITCH, disassemble_method): Likewise. * jcf-io.c: Include tree.h/java-tree.h. (open_class, find_classfile, jcf_print_utf8, jcf_print_utf8_replace): Const-ify. * jcf-parse.c (parse_zip_file_entries, process_zip_dir, parse_class_file): Add static prototype. (find_in_current_zip): Match definition to existing static prototype. * jcf-write.c: Include jcf.h before tree.h/java-tree.h. (alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label, finish_jcf_block, define_jcf_label, get_jcf_label_here, put_linenumber, localvar_alloc, localvar_free, get_access_flags, write_chunks, adjust_typed_op, generate_bytecode_conditional, generate_bytecode_return, perform_relocations, init_jcf_state, init_jcf_method, release_jcf_state, generate_classfile): Add static prototype. (emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED. (make_class_file_name): Const-ify. * jcf.h (find_classfile): Const-ify. * jv-scan.c (reset_report): Remove prototype. * jvgenmain.c: Include jcf.h/tree.h/java-tree.h. (error): Rewrite to allow varargs. * lang.c (lang_f_options): Const-ify. * lex.c (java_parse_escape_sequence): Add static prototype. (java_allocate_new_line): Match definition to existing static prototype. * mangle.c Include tree.h/java-tree.h. (unicode_mangling_length, emit_unicode_mangled_name, append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify. * parse.h (jdep_code): Remove trailing comma in enumeration. (java_get_line_col): Move prototype outside of !JC1_LITE test. (reset_report): Add prototype. * verify.c (push_pending_label, merge_types): Add static prototypes. * zipfile.h (opendir_in_zip, open_in_zip): Prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25878 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog109
-rw-r--r--gcc/java/Makefile.in7
-rw-r--r--gcc/java/check-init.c3
-rw-r--r--gcc/java/class.c32
-rw-r--r--gcc/java/constants.c18
-rw-r--r--gcc/java/decl.c15
-rw-r--r--gcc/java/except.c7
-rw-r--r--gcc/java/expr.c118
-rw-r--r--gcc/java/java-tree.h42
-rw-r--r--gcc/java/jcf-dump.c42
-rw-r--r--gcc/java/jcf-io.c14
-rw-r--r--gcc/java/jcf-parse.c13
-rw-r--r--gcc/java/jcf-write.c74
-rw-r--r--gcc/java/jcf.h2
-rw-r--r--gcc/java/jv-scan.c1
-rw-r--r--gcc/java/jvgenmain.c23
-rw-r--r--gcc/java/lang.c3
-rw-r--r--gcc/java/lex.c4
-rw-r--r--gcc/java/mangle.c24
-rw-r--r--gcc/java/parse.h7
-rw-r--r--gcc/java/verify.c7
-rw-r--r--gcc/java/zipfile.h6
22 files changed, 411 insertions, 160 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 263f2f8b69b..db687142155 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,112 @@
+Sun Mar 21 08:30:30 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (jcf-dump.o): Depend on $(CONFIG_H)
+ $(srcdir)/../system.h and $(JAVA_TREE_H).
+ (jcf-io.o): Depend on $(JAVA_TREE_H).
+ (mangle.o): Likewise.
+
+ * check-init.c (check_cond_init): Add static prototype.
+
+ * class.c (build_java_method_type, hashUtf8String,
+ make_field_value, get_dispatch_vector, get_dispatch_table,
+ append_gpp_mangled_type, mangle_static_field): Likewise.
+ (strLengthUtf8): Hide unused definition.
+ (hashUtf8String): Const-ify.
+ (make_field_value): Un-ANSI-fy.
+
+ * constants.c: Move inclusion of jcf.h above java-tree.h.
+ (set_constant_entry, find_class_or_string_constant,
+ find_name_and_type_constant, get_tag_node,
+ build_constant_data_ref): Add static prototype.
+
+ * decl.c (push_jvm_slot, builtin_function,
+ lookup_name_current_level): Likewise.
+ (builtin_function): Const-ify.
+
+ * except.c (expand_start_java_handler, expand_end_java_handler):
+ Add static prototype.
+
+ * expr.c (flush_quick_stack, push_value, pop_value,
+ java_stack_swap, java_stack_dup, build_java_athrow,
+ build_java_jsr, build_java_ret, expand_java_multianewarray,
+ expand_java_arraystore, expand_java_arrayload,
+ expand_java_array_length, build_java_monitor, expand_java_pushc,
+ expand_java_return, expand_java_NEW, expand_java_INSTANCEOF,
+ expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label,
+ expand_compare, expand_test, expand_cond, expand_java_goto,
+ expand_java_call, expand_java_ret, pop_arguments, expand_invoke,
+ expand_java_field_op, java_push_constant_from_pool): Likewise.
+
+ (decode_newarray_type, expand_iinc): Un-ANSI-fy.
+ (build_java_arraynull_check): Mark parameters `node' and `type'
+ with ATTRIBUTE_UNUSED.
+ (note_label): Likewise for parameter `current_pc'.
+ (expand_java_call, expand_java_ret): Hide unused definition.
+
+ * java-tree.h (make_class, build_constants_constructor,
+ java_set_exception_lang_code, pop_labeled_block, emit_handlers,
+ init_outgoing_cpool, register_class, emit_register_classes,
+ java_layout_seen_class_methods): Prototype.
+ (unicode_mangling_length): Const-ify.
+ (append_gpp_mangled_name, append_gpp_mangled_classtype,
+ emit_unicode_mangled_name, format_int, format_uint,
+ jcf_trim_old_input, jcf_print_utf8, jcf_print_char,
+ jcf_print_utf8_replace, open_class): Prototype.
+
+ * jcf-dump.c: Include "config.h", not <config.h>. Don't include
+ <stdio.h>. Include tree.h/java-tree.h.
+ (utf8_equal_string usage, process_class): Add static prototype.
+ (open_class): Don't prototype this here.
+ (utf8_equal_string): Match arguments to format specifiers.
+ (HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH,
+ TABLE_SWITCH, disassemble_method): Likewise.
+
+ * jcf-io.c: Include tree.h/java-tree.h.
+ (open_class, find_classfile, jcf_print_utf8,
+ jcf_print_utf8_replace): Const-ify.
+
+ * jcf-parse.c (parse_zip_file_entries, process_zip_dir,
+ parse_class_file): Add static prototype.
+ (find_in_current_zip): Match definition to existing static
+ prototype.
+
+ * jcf-write.c: Include jcf.h before tree.h/java-tree.h.
+ (alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label,
+ finish_jcf_block, define_jcf_label, get_jcf_label_here,
+ put_linenumber, localvar_alloc, localvar_free, get_access_flags,
+ write_chunks, adjust_typed_op, generate_bytecode_conditional,
+ generate_bytecode_return, perform_relocations, init_jcf_state,
+ init_jcf_method, release_jcf_state, generate_classfile):
+ Add static prototype.
+ (emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED.
+ (make_class_file_name): Const-ify.
+
+ * jcf.h (find_classfile): Const-ify.
+
+ * jv-scan.c (reset_report): Remove prototype.
+
+ * jvgenmain.c: Include jcf.h/tree.h/java-tree.h.
+ (error): Rewrite to allow varargs.
+
+ * lang.c (lang_f_options): Const-ify.
+
+ * lex.c (java_parse_escape_sequence): Add static prototype.
+ (java_allocate_new_line): Match definition to existing static
+ prototype.
+
+ * mangle.c Include tree.h/java-tree.h.
+ (unicode_mangling_length, emit_unicode_mangled_name,
+ append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify.
+
+ * parse.h (jdep_code): Remove trailing comma in enumeration.
+ (java_get_line_col): Move prototype outside of !JC1_LITE test.
+ (reset_report): Add prototype.
+
+ * verify.c (push_pending_label, merge_types): Add static
+ prototypes.
+
+ * zipfile.h (opendir_in_zip, open_in_zip): Prototype.
+
1999-03-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (find_applicable_accessible_methods_list): Extend the
diff --git a/gcc/java/Makefile.in b/gcc/java/Makefile.in
index b5696a52d87..5e50dfe5b04 100644
--- a/gcc/java/Makefile.in
+++ b/gcc/java/Makefile.in
@@ -274,7 +274,8 @@ clean: mostlyclean
force:
parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h
-jcf-dump.o : jcf-dump.c jcf-reader.c jcf.h javaop.h javaop.def
+jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
+ jcf-reader.c jcf.h javaop.h javaop.def
gjavah.o : $(CONFIG_H) $(srcdir)/../system.h gjavah.c \
jcf-reader.c jcf.h javaop.h
buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \
@@ -297,7 +298,7 @@ expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
$(srcdir)/../system.h
jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
-jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h
+jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(PARSE_H)
@@ -307,7 +308,7 @@ jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h
jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h
-mangle.o : mangle.c $(CONFIG_H) jcf.h $(srcdir)/../system.h \
+mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c
index bf1e3deb6a8..071faf74924 100644
--- a/gcc/java/check-init.c
+++ b/gcc/java/check-init.c
@@ -99,6 +99,7 @@ static tree wfl;
static void check_bool_init PROTO ((tree, words, words, words));
static void check_init PROTO ((tree, words));
+static void check_cond_init PROTO ((tree, tree, tree, words, words, words));
#if 0
#define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word)))
@@ -123,7 +124,7 @@ static void check_init PROTO ((tree, words));
definite assignment.
BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */
-void
+static void
check_cond_init (test_exp, then_exp, else_exp,
before, when_false, when_true)
tree test_exp, then_exp, else_exp;
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 53ccf3e81e8..cb418cd8b3c 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -38,6 +38,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
static tree mangle_class_field PROTO ((tree class));
static tree make_method_value PROTO ((tree));
+static tree build_java_method_type PROTO ((tree, tree, int));
+static int32 hashUtf8String PROTO ((const char *, int));
+static tree make_field_value PROTO ((tree));
+static tree get_dispatch_vector PROTO ((tree));
+static tree get_dispatch_table PROTO ((tree, tree));
+static void append_gpp_mangled_type PROTO ((struct obstack *, tree));
+static tree mangle_static_field PROTO ((tree));
static rtx registerClass_libfunc;
@@ -382,7 +389,7 @@ find_named_method (list, name)
}
#endif
-tree
+static tree
build_java_method_type (fntype, this_class, access_flags)
tree fntype;
tree this_class;
@@ -503,6 +510,7 @@ set_constant_value (field, constant)
/* Count the number of Unicode chars encoded in a given Ut8 string. */
+#if 0
int
strLengthUtf8 (str, len)
char *str;
@@ -517,19 +525,20 @@ strLengthUtf8 (str, len)
}
return str_length;
}
+#endif
/* Calculate a hash value for a string encoded in Utf8 format.
* This returns the same hash value as specified for java.lang.String.hashCode.
*/
-int32
+static int32
hashUtf8String (str, len)
- char *str;
+ const char *str;
int len;
{
- register unsigned char* ptr = (unsigned char*) str;
- register unsigned char *limit = ptr + len;
+ register const unsigned char* ptr = (const unsigned char*) str;
+ register const unsigned char *limit = ptr + len;
int32 hash = 0;
for (; ptr < limit;)
{
@@ -841,8 +850,9 @@ get_access_flags_from_decl (decl)
abort ();
}
-tree
-make_field_value (tree fdecl)
+static tree
+make_field_value (fdecl)
+ tree fdecl;
{
tree finit, info;
int bsize, flags;
@@ -917,7 +927,7 @@ make_method_value (mdecl)
return minit;
}
-tree
+static tree
get_dispatch_vector (type)
tree type;
{
@@ -950,7 +960,7 @@ get_dispatch_vector (type)
return vtable;
}
-tree
+static tree
get_dispatch_table (type, this_class_addr)
tree type, this_class_addr;
{
@@ -1258,7 +1268,7 @@ is_compiled_class (class)
/* Append the mangled name of TYPE onto OBSTACK. */
-void
+static void
append_gpp_mangled_type (obstack, type)
struct obstack *obstack;
tree type;
@@ -1333,7 +1343,7 @@ mangle_class_field (class)
/* Build the mangled (assembly-level) name of the static field FIELD. */
-tree
+static tree
mangle_static_field (field)
tree field;
{
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index 81ff7adc35e..a1f820e0dd2 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -23,16 +23,22 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h"
#include "system.h"
+#include "jcf.h"
#include "tree.h"
#include "java-tree.h"
-#include "jcf.h"
#include "toplev.h"
extern struct obstack permanent_obstack;
+static void set_constant_entry PROTO ((CPool *, int, int, jword));
+static int find_class_or_string_constant PROTO ((CPool *, int, tree));
+static int find_name_and_type_constant PROTO ((CPool *, tree, tree));
+static tree get_tag_node PROTO ((int));
+static tree build_constant_data_ref PROTO ((void));
+
/* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
-void
+static void
set_constant_entry (cpool, index, tag, value)
CPool *cpool;
int index;
@@ -113,7 +119,7 @@ find_utf8_constant (cpool, name)
return find_constant1 (cpool, CONSTANT_Utf8, (jword) name);
}
-int
+static int
find_class_or_string_constant (cpool, tag, name)
CPool *cpool;
int tag;
@@ -155,7 +161,7 @@ find_string_constant (cpool, string)
/* Find (or create) a CONSTANT_NameAndType matching NAME and TYPE.
Return its index in the constant pool CPOOL. */
-int
+static int
find_name_and_type_constant (cpool, name, type)
CPool *cpool;
tree name;
@@ -316,7 +322,7 @@ tree current_constant_pool_data_ref;
/* A Cache for build_int_2 (CONSTANT_XXX, 0). */
static tree tag_nodes[13];
-tree
+static tree
get_tag_node (tag)
int tag;
{
@@ -378,7 +384,7 @@ alloc_class_constant (clas)
/* Return a reference to the data array of the current constant pool. */
-tree
+static tree
build_constant_data_ref ()
{
if (current_constant_pool_data_ref == NULL_TREE)
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 707fa3c9dc3..02993d9f9f1 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -33,6 +33,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "jcf.h"
#include "toplev.h"
+static tree push_jvm_slot PROTO ((int, tree));
+static tree builtin_function PROTO ((const char *, tree,
+ enum built_in_function, const char *));
+static tree lookup_name_current_level PROTO ((tree));
+
#ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD
#endif
@@ -55,7 +60,7 @@ tree pending_local_decls = NULL_TREE;
/* Push a local variable or stack slot into the decl_map,
and assign it an rtl. */
-tree
+static tree
push_jvm_slot (index, decl)
int index;
tree decl;
@@ -396,12 +401,12 @@ tree integer_negative_one_node;
If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
the name to be called if we can't opencode the function. */
-tree
+static tree
builtin_function (name, type, function_code, library_name)
- char *name;
+ const char *name;
tree type;
enum built_in_function function_code;
- char *library_name;
+ const char *library_name;
{
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
@@ -811,7 +816,7 @@ lookup_name (name)
/* Similar to `lookup_name' but look only at current binding level and
the previous one if its the parameter level. */
-tree
+static tree
lookup_name_current_level (name)
tree name;
{
diff --git a/gcc/java/except.c b/gcc/java/except.c
index 7c393be6c46..8fbf0b60e06 100644
--- a/gcc/java/except.c
+++ b/gcc/java/except.c
@@ -36,6 +36,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "eh-common.h"
#include "toplev.h"
+static void expand_start_java_handler PROTO ((struct eh_range *));
+static void expand_end_java_handler PROTO ((struct eh_range *));
+
extern struct obstack permanent_obstack;
struct eh_range *current_method_handlers;
@@ -182,7 +185,7 @@ add_handler (start_pc, end_pc, handler, type)
/* if there are any handlers for this range, issue start of region */
-void
+static void
expand_start_java_handler (range)
struct eh_range *range ATTRIBUTE_UNUSED;
{
@@ -217,7 +220,7 @@ prepare_eh_table_type (type)
/* if there are any handlers for this range, isssue end of range,
and then all handler blocks */
-void
+static void
expand_end_java_handler (range)
struct eh_range *range;
{
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 15ac0c2b52e..268861d68a4 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -40,6 +40,40 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "except.h"
+static void flush_quick_stack PROTO ((void));
+static void push_value PROTO ((tree));
+static tree pop_value PROTO ((tree));
+static void java_stack_swap PROTO ((void));
+static void java_stack_dup PROTO ((int, int));
+static tree build_java_athrow PROTO ((tree));
+static void build_java_jsr PROTO ((tree, tree));
+static void build_java_ret PROTO ((tree));
+static void expand_java_multianewarray PROTO ((tree, int));
+static void expand_java_arraystore PROTO ((tree));
+static void expand_java_arrayload PROTO ((tree));
+static void expand_java_array_length PROTO ((void));
+static tree build_java_monitor PROTO ((tree, tree));
+static void expand_java_pushc PROTO ((int, tree));
+static void expand_java_return PROTO ((tree));
+static void expand_java_NEW PROTO ((tree));
+static void expand_java_INSTANCEOF PROTO ((tree));
+static void expand_java_CHECKCAST PROTO ((tree));
+static void expand_iinc PROTO ((unsigned int, int, int));
+static void expand_java_binop PROTO ((tree, enum tree_code));
+static void note_label PROTO ((int, int));
+static void expand_compare PROTO ((enum tree_code, tree, tree, int));
+static void expand_test PROTO ((enum tree_code, tree, int));
+static void expand_cond PROTO ((enum tree_code, tree, int));
+static void expand_java_goto PROTO ((int));
+#if 0
+static void expand_java_call PROTO ((int, int));
+static void expand_java_ret PROTO ((tree));
+#endif
+static tree pop_arguments PROTO ((tree));
+static void expand_invoke PROTO ((int, int, int));
+static void expand_java_field_op PROTO ((int, int, int));
+static void java_push_constant_from_pool PROTO ((struct JCF *, int));
+
static tree operand_type[59];
extern struct obstack permanent_obstack;
@@ -168,7 +202,7 @@ unhand_expr (expr)
that the expression for a slot may contain decls for stack slots with
higher (or the same) index, but not lower. */
-void
+static void
flush_quick_stack ()
{
int stack_index = stack_pointer;
@@ -216,7 +250,7 @@ push_type (type)
stack_type_map[stack_pointer++] = TYPE_SECOND;
}
-void
+static void
push_value (value)
tree value;
{
@@ -353,7 +387,7 @@ can_widen_reference_to (source_type, target_type)
}
}
-tree
+static tree
pop_value (type)
tree type;
{
@@ -374,7 +408,7 @@ pop_value (type)
/* Pop and discrad the top COUNT stack slots. */
-void
+static void
java_stack_pop (count)
int count;
{
@@ -398,7 +432,7 @@ java_stack_pop (count)
/* Implement the 'swap' operator (to swap two top stack slots). */
-void
+static void
java_stack_swap ()
{
tree type1, type2;
@@ -422,7 +456,7 @@ java_stack_swap ()
stack_type_map[stack_pointer - 2] = type1;
}
-void
+static void
java_stack_dup (size, offset)
int size, offset;
{
@@ -467,7 +501,7 @@ java_stack_dup (size, offset)
/* Calls _Jv_Throw. Discard the contents of the value stack. */
-tree
+static tree
build_java_athrow (node)
tree node;
{
@@ -485,7 +519,7 @@ build_java_athrow (node)
/* Implementation for jsr/ret */
-void
+static void
build_java_jsr (where, ret)
tree where;
tree ret;
@@ -497,7 +531,7 @@ build_java_jsr (where, ret)
expand_label (ret);
}
-void
+static void
build_java_ret (location)
tree location;
{
@@ -515,7 +549,8 @@ build_java_ret (location)
size_int (BITS_PER_UNIT))
tree
-decode_newarray_type (int atype)
+decode_newarray_type (atype)
+ int atype;
{
switch (atype)
{
@@ -599,9 +634,9 @@ build_java_array_length_access (node)
tree
build_java_arraynull_check (node, expr, type)
- tree node;
- tree expr;
- tree type;
+ tree node ATTRIBUTE_UNUSED;
+ tree expr;
+ tree type ATTRIBUTE_UNUSED;
{
#if 0
static int java_array_access_throws_null_exception = 0;
@@ -768,7 +803,7 @@ build_new_array (type, length)
class pointer, a number of dimensions and the matching number of
dimensions. The argument list is NULL terminated. */
-void
+static void
expand_java_multianewarray (class_type, ndim)
tree class_type;
int ndim;
@@ -798,7 +833,7 @@ expand_java_multianewarray (class_type, ndim)
to make sure that the RHS can be assigned to the array element
type. It is not necessary to generate this code if ARRAY is final. */
-void
+static void
expand_java_arraystore (rhs_type_node)
tree rhs_type_node;
{
@@ -840,7 +875,7 @@ expand_java_arraystore (rhs_type_node)
BOOLEAN/SHORT, we push a promoted type back to the stack.
*/
-void
+static void
expand_java_arrayload (lhs_type_node )
tree lhs_type_node;
{
@@ -864,7 +899,7 @@ expand_java_arrayload (lhs_type_node )
/* Expands .length. Makes sure that we deal with and array and may expand
a NULL check on the array object. */
-void
+static void
expand_java_array_length ()
{
tree array = pop_value (ptr_type_node);
@@ -876,7 +911,7 @@ expand_java_array_length ()
/* Emit code for the call to _Jv_Monitor{Enter,Exit}. CALL can be
either soft_monitorenter_node or soft_monitorexit_node. */
-tree
+static tree
build_java_monitor (call, object)
tree call;
tree object;
@@ -890,7 +925,7 @@ build_java_monitor (call, object)
/* Emit code for one of the PUSHC instructions. */
-void
+static void
expand_java_pushc (ival, type)
int ival;
tree type;
@@ -918,7 +953,7 @@ expand_java_pushc (ival, type)
push_value (value);
}
-void
+static void
expand_java_return (type)
tree type;
{
@@ -941,7 +976,7 @@ build_address_of (value)
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value);
}
-void
+static void
expand_java_NEW (type)
tree type;
{
@@ -956,7 +991,7 @@ expand_java_NEW (type)
NULL_TREE));
}
-void
+static void
expand_java_INSTANCEOF (type)
tree type;
{
@@ -970,7 +1005,7 @@ expand_java_INSTANCEOF (type)
push_value (value);
}
-void
+static void
expand_java_CHECKCAST (type)
tree type;
{
@@ -983,8 +1018,11 @@ expand_java_CHECKCAST (type)
push_value (value);
}
-void
-expand_iinc (unsigned int local_var_index, int ival, int pc)
+static void
+expand_iinc (local_var_index, ival, pc)
+ unsigned int local_var_index;
+ int ival;
+ int pc;
{
tree local_var, res;
tree constant_value;
@@ -1070,7 +1108,7 @@ build_java_binop (op, type, arg1, arg2)
return fold (build (op, type, arg1, arg2));
}
-void
+static void
expand_java_binop (type, op)
tree type; enum tree_code op;
{
@@ -1205,9 +1243,9 @@ create_label_decl (name)
/* This maps a bytecode offset (PC) to various flags. */
char *instruction_bits;
-void
+static void
note_label (current_pc, target_pc)
- int current_pc, target_pc;
+ int current_pc ATTRIBUTE_UNUSED, target_pc;
{
lookup_label (target_pc);
instruction_bits [target_pc] |= BCODE_JUMP_TARGET;
@@ -1216,7 +1254,7 @@ note_label (current_pc, target_pc)
/* Emit code to jump to TARGET_PC if VALUE1 CONDITION VALUE2,
where CONDITION is one of one the compare operators. */
-void
+static void
expand_compare (condition, value1, value2, target_pc)
enum tree_code condition;
tree value1, value2;
@@ -1231,7 +1269,7 @@ expand_compare (condition, value1, value2, target_pc)
/* Emit code for a TEST-type opcode. */
-void
+static void
expand_test (condition, type, target_pc)
enum tree_code condition;
tree type;
@@ -1246,7 +1284,7 @@ expand_test (condition, type, target_pc)
/* Emit code for a COND-type opcode. */
-void
+static void
expand_cond (condition, type, target_pc)
enum tree_code condition;
tree type;
@@ -1261,7 +1299,7 @@ expand_cond (condition, type, target_pc)
expand_compare (condition, value1, value2, target_pc);
}
-void
+static void
expand_java_goto (target_pc)
int target_pc;
{
@@ -1270,7 +1308,8 @@ expand_java_goto (target_pc)
expand_goto (target_label);
}
-void
+#if 0
+static void
expand_java_call (target_pc, return_address)
int target_pc, return_address;
{
@@ -1281,9 +1320,9 @@ expand_java_call (target_pc, return_address)
expand_goto (target_label);
}
-void
+static void
expand_java_ret (return_address)
- tree return_address;
+ tree return_address ATTRIBUTE_UNUSED;
{
warning ("ret instruction not implemented");
#if 0
@@ -1292,6 +1331,7 @@ expand_java_ret (return_address)
expand_goto (target_label);
#endif
}
+#endif
/* Recursive helper function to pop argument types during verifiation. */
@@ -1310,7 +1350,7 @@ pop_argument_types (arg_types)
abort ();
}
-tree
+static tree
pop_arguments (arg_types)
tree arg_types;
{
@@ -1492,7 +1532,7 @@ build_invokeinterface (dtable, method_name, method_signature)
METHOD_REF_INDEX is an index into the constant pool.
NARGS is the number of arguments, or -1 if not specified. */
-void
+static void
expand_invoke (opcode, method_ref_index, nargs)
int opcode;
int method_ref_index;
@@ -1599,7 +1639,7 @@ expand_invoke (opcode, method_ref_index, nargs)
IS_PUTTING is 1 for putting into a field; 0 for getting from the field.
FIELD_REF_INDEX is an index into the constant pool. */
-void
+static void
expand_java_field_op (is_static, is_putting, field_ref_index)
int is_static;
int is_putting;
@@ -2131,7 +2171,7 @@ expand_byte_code (jcf, method)
} /* for */
}
-void
+static void
java_push_constant_from_pool (jcf, index)
JCF *jcf;
int index;
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 62b69f4f725..b9501ad8b66 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -482,7 +482,7 @@ extern void jcf_parse PROTO ((struct JCF*));
extern tree add_field PROTO ((tree, tree, tree, int));
extern tree add_method PROTO ((tree, int, tree, tree));
extern tree add_method_1 PROTO ((tree, int, tree, tree));
-extern tree make_class ();
+extern tree make_class PROTO ((void));
extern tree push_class PROTO ((tree, tree));
extern tree unmangle_classname PROTO ((const char *name, int name_length));
extern tree parse_signature_string PROTO ((const unsigned char *, int));
@@ -490,11 +490,10 @@ extern tree get_type_from_signature PROTO ((tree));
extern void layout_class PROTO ((tree));
extern tree layout_class_method PROTO ((tree, tree, tree, tree));
extern void layout_class_methods PROTO ((tree));
-extern tree make_class ();
extern tree build_class_ref PROTO ((tree));
extern tree build_dtable_decl PROTO ((tree));
extern tree build_internal_class_name PROTO ((tree));
-extern tree build_constants_constructor ();
+extern tree build_constants_constructor PROTO ((void));
extern tree build_ref_from_constant_pool PROTO ((int));
extern tree build_utf8_ref PROTO ((tree));
extern tree ident_subst PROTO ((const char*, int,
@@ -541,9 +540,9 @@ extern tree build_java_arraynull_check PROTO ((tree, tree, tree));
extern tree create_label_decl PROTO ((tree));
extern void push_labeled_block PROTO ((tree));
extern tree prepare_eh_table_type PROTO ((tree));
-extern void java_set_exception_lang_code PROTO (());
+extern void java_set_exception_lang_code PROTO ((void));
extern tree generate_name PROTO ((void));
-extern void pop_labeled_block PROTO (());
+extern void pop_labeled_block PROTO ((void));
extern char *lang_printable_name PROTO ((tree, int));
extern tree maybe_add_interface PROTO ((tree, tree));
extern void set_super_info PROTO ((int, tree, tree, int));
@@ -552,12 +551,12 @@ extern int interface_of_p PROTO ((tree, tree));
extern int inherits_from_p PROTO ((tree, tree));
extern void complete_start_java_method PROTO ((tree));
extern tree build_result_decl PROTO ((tree));
-extern void emit_handlers PROTO (());
-extern void init_outgoing_cpool PROTO (());
+extern void emit_handlers PROTO ((void));
+extern void init_outgoing_cpool PROTO ((void));
extern void make_class_data PROTO ((tree));
-extern void register_class PROTO (());
+extern void register_class PROTO ((void));
extern int alloc_name_constant PROTO ((int, tree));
-extern void emit_register_classes PROTO (());
+extern void emit_register_classes PROTO ((void));
extern void lang_init_source PROTO ((int));
extern void write_classfile PROTO ((tree));
extern char *print_int_node PROTO ((tree));
@@ -566,12 +565,12 @@ extern void parse_error_context PVPROTO ((tree cl, const char *, ...))
extern tree build_primtype_type_ref PROTO ((char *));
extern tree java_get_real_method_name PROTO ((tree));
extern void finish_class PROTO ((tree));
-extern void java_layout_seen_class_methods PROTO (());
+extern void java_layout_seen_class_methods PROTO ((void));
extern void check_for_initialization PROTO ((tree));
extern tree pushdecl_top_level PROTO ((tree));
extern int alloc_class_constant PROTO ((tree));
-extern int unicode_mangling_length PROTO ((char *, int));
+extern int unicode_mangling_length PROTO ((const char *, int));
extern void init_expr_processing PROTO ((void));
extern void push_super_field PROTO ((tree, tree));
extern void init_class_processing PROTO ((void));
@@ -586,8 +585,9 @@ extern int merge_type_state PROTO ((tree));
extern void push_type PROTO ((tree));
extern void load_type_state PROTO ((tree));
extern void add_interface PROTO ((tree, tree));
-extern void append_gpp_mangled_classtype PROTO ((struct obstack *, char *));
-extern void emit_unicode_mangled_name PROTO ((struct obstack *, char *, int));
+extern void append_gpp_mangled_name PROTO ((struct obstack *, const char *, int));
+extern void append_gpp_mangled_classtype PROTO ((struct obstack *, const char *));
+extern void emit_unicode_mangled_name PROTO ((struct obstack *, const char *, int));
extern tree force_evaluation_order PROTO ((tree));
extern int verify_constant_pool PROTO ((struct JCF *));
extern void start_java_method PROTO ((tree));
@@ -608,6 +608,22 @@ extern int find_methodref_index PROTO ((struct CPool *, tree));
extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int));
extern int count_constant_pool_bytes PROTO ((struct CPool *));
extern int encode_newarray_type PROTO ((tree));
+#ifdef uint64
+extern void format_int PROTO ((char *, jlong, int));
+extern void format_uint PROTO ((char *, uint64, int));
+#endif
+extern void jcf_trim_old_input PROTO ((struct JCF *));
+#ifdef BUFSIZ
+extern void jcf_print_utf8 PROTO ((FILE *, const unsigned char *, int));
+extern void jcf_print_char PROTO ((FILE *, int));
+extern void jcf_print_utf8_replace PROTO ((FILE *, const unsigned char *,
+ int, int, int));
+# if JCF_USE_STDIO
+extern char* open_class PROTO ((char *, struct JCF *, FILE *, const char *));
+# else
+extern char* open_class PROTO ((char *, struct JCF *, int, const char *));
+# endif /* JCF_USE_STDIO */
+#endif
/* Access flags etc for a method (a FUNCTION_DECL): */
diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c
index eaf07cdc91f..32475920c18 100644
--- a/gcc/java/jcf-dump.c
+++ b/gcc/java/jcf-dump.c
@@ -46,11 +46,12 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
*/
-#include <config.h>
+#include "config.h"
#include "system.h"
-#include <stdio.h>
#include "jcf.h"
+#include "tree.h"
+#include "java-tree.h"
/* Outout file. */
FILE *out;
@@ -84,15 +85,16 @@ static void print_constant_ref PROTO ((FILE *, JCF *, int));
static void disassemble_method PROTO ((JCF*, unsigned char *, int));
static void print_name PROTO ((FILE*, JCF*, int));
static void print_signature PROTO ((FILE*, JCF*, int, int));
+static int utf8_equal_string PROTO ((struct JCF*, int, const char *));
+static int usage PROTO ((void));
+static void process_class PROTO ((struct JCF *));
#define PRINT_SIGNATURE_RESULT_ONLY 1
#define PRINT_SIGNATURE_ARGS_ONLY 2
-extern char* open_class();
-
-int
+static int
DEFUN(utf8_equal_string, (jcf, index, value),
- JCF *jcf AND int index AND char * value)
+ JCF *jcf AND int index AND const char * value)
{
if (CPOOL_INDEX_IN_RANGE (&jcf->cpool, index)
&& JPOOL_TAG (jcf, index) == CONSTANT_Utf8)
@@ -109,8 +111,8 @@ DEFUN(utf8_equal_string, (jcf, index, value),
this_class_index = 0; \
if (flag_print_class_info) \
fprintf (out, \
- "Magic number: 0x%0x, minor_version: %d, major_version: %d.\n", \
- MAGIC, MINOR, MAJOR)
+ "Magic number: 0x%0lx, minor_version: %ld, major_version: %ld.\n",\
+ (long) MAGIC, (long) MINOR, (long) MAJOR)
#define HANDLE_START_CONSTANT_POOL(COUNT) \
if (flag_print_constant_pool) \
@@ -238,8 +240,8 @@ DEFUN(utf8_equal_string, (jcf, index, value),
#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
{ COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \
- fprintf (out, ", max_stack:%d, max_locals:%d, code_length:%d\n", \
- MAX_STACK, MAX_LOCALS, CODE_LENGTH); \
+ fprintf (out, ", max_stack:%ld, max_locals:%ld, code_length:%ld\n", \
+ (long) MAX_STACK, (long) MAX_LOCALS, (long) CODE_LENGTH); \
disassemble_method (jcf, jcf->read_ptr, CODE_LENGTH); }
#define HANDLE_EXCEPTION_TABLE(ENTRIES, COUNT) \
@@ -345,7 +347,7 @@ DEFUN(print_name, (stream, jcf, name_index),
/* If the type of the constant at INDEX matches EXPECTED,
print it tersely, otherwise more verbosely. */
-void
+static void
DEFUN(print_constant_terse, (out, jcf, index, expected),
FILE *out AND JCF *jcf AND int index AND int expected)
{
@@ -656,14 +658,14 @@ DEFUN(print_exception_table, (jcf, entries, count),
#include "jcf-reader.c"
-int
+static int
DEFUN (usage, (), )
{
fprintf (stderr, "Usage: jcf-dump [-o outputfile] [-c] classname\n");
exit(1);
}
-void
+static void
DEFUN(process_class, (jcf),
JCF *jcf)
{
@@ -1021,24 +1023,24 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
#define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \
saw_index = 0, INT_temp = (OPERAND_VALUE); \
- fprintf (out, " %d", saw_index ? INT_temp : oldpc + INT_temp)
+ fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
#define JSR(OPERAND_TYPE, OPERAND_VALUE) \
saw_index = 0, INT_temp = (OPERAND_VALUE); \
- fprintf (out, " %d", saw_index ? INT_temp : oldpc + INT_temp)
+ fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
#undef RET /* Defined by config/i386/i386.h */
#define RET(OPERAND_TYPE, OPERAND_VALUE) \
INT_temp = saw_wide ? IMMEDIATE_u2 : (OPERAND_VALUE); \
saw_wide = 0; \
- fprintf (out, " %d", INT_temp);
+ fprintf (out, " %ld", (long) INT_temp);
#define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \
PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH
#define LOOKUP_SWITCH \
{ jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \
- fprintf (out, " npairs=%d, default=%d", npairs, default_offset+oldpc); \
+ fprintf (out, " npairs=%ld, default=%ld", (long) npairs, (long) default_offset+oldpc); \
while (--npairs >= 0) { \
jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \
fprintf (out, "\n%10ld: %ld", (long)match, (long)(offset+oldpc)); } \
@@ -1047,8 +1049,8 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
#define TABLE_SWITCH \
{ jint default_offset = IMMEDIATE_s4; \
jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
- fprintf (out, " low=%d, high=%d, default=%d", \
- low, high, default_offset+oldpc); \
+ fprintf (out, " low=%ld, high=%ld, default=%ld", \
+ (long) low, (long) high, (long) default_offset+oldpc); \
for (; low <= high; low++) { \
jint offset = IMMEDIATE_s4; \
fprintf (out, "\n%10ld: %ld", (long)low, (long)(offset+oldpc)); } \
@@ -1085,7 +1087,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
else
{
saw_wide = 0;
- fprintf (out, " %d", INT_temp);
+ fprintf (out, " %ld", (long) INT_temp);
}
fputc ('\n', out);
break;
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index e1ccccf30f2..e4d614d687e 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -26,6 +26,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h"
#include "jcf.h"
+#include "tree.h"
+#include "java-tree.h"
/* DOS brain-damage */
#ifndef O_BINARY
@@ -182,7 +184,7 @@ DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
#if JCF_USE_STDIO
char*
DEFUN(open_class, (filename, jcf, stream, dep_name),
- char *filename AND JCF *jcf AND FILE* stream AND char *dep_name)
+ char *filename AND JCF *jcf AND FILE* stream AND const char *dep_name)
{
if (jcf)
{
@@ -203,7 +205,7 @@ DEFUN(open_class, (filename, jcf, stream, dep_name),
#else
char*
DEFUN(open_class, (filename, jcf, fd, dep_name),
- char *filename AND JCF *jcf AND int fd AND char *dep_name)
+ char *filename AND JCF *jcf AND int fd AND const char *dep_name)
{
if (jcf)
{
@@ -240,7 +242,7 @@ DEFUN(open_class, (filename, jcf, fd, dep_name),
char *
DEFUN(find_classfile, (filename, jcf, dep_name),
- char *filename AND JCF *jcf AND char *dep_name)
+ char *filename AND JCF *jcf AND const char *dep_name)
{
#if JCF_USE_STDIO
FILE *stream = fopen (filename, "rb");
@@ -458,9 +460,9 @@ DEFUN(jcf_print_char, (stream, ch),
void
DEFUN(jcf_print_utf8, (stream, str, length),
- FILE *stream AND register unsigned char *str AND int length)
+ FILE *stream AND register const unsigned char *str AND int length)
{
- unsigned char* limit = str + length;
+ const unsigned char * limit = str + length;
while (str < limit)
{
int ch = UTF8_GET (str, limit);
@@ -477,7 +479,7 @@ DEFUN(jcf_print_utf8, (stream, str, length),
void
DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char),
- FILE *stream AND unsigned char *str AND int length
+ FILE *stream AND const unsigned char *str AND int length
AND int in_char AND int out_char)
{
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 9b854b4442a..58dd7223fac 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -79,12 +79,13 @@ static tree current_method = NULL_TREE;
/* Declarations of some functions used here. */
static tree give_name_to_class PROTO ((JCF *jcf, int index));
-void parse_zip_file_entries PROTO (());
-void process_zip_dir PROTO (());
+static void parse_zip_file_entries PROTO ((void));
+static void process_zip_dir PROTO ((void));
static void parse_source_file PROTO ((tree));
static void jcf_parse_source PROTO ((void));
static int jcf_figure_file_type PROTO ((JCF *));
static int find_in_current_zip PROTO ((char *, struct JCF **));
+static void parse_class_file PROTO ((void));
/* Handle "SourceFile" attribute. */
@@ -662,7 +663,7 @@ init_outgoing_cpool ()
}
}
-void
+static void
parse_class_file ()
{
tree method;
@@ -854,7 +855,7 @@ yyparse ()
static struct ZipFileCache *localToFile;
/* Process all class entries found in the zip file. */
-void
+static void
parse_zip_file_entries (void)
{
struct ZipDirectory *zdir;
@@ -895,7 +896,7 @@ parse_zip_file_entries (void)
/* Read all the entries of the zip file, creates a class and a JCF. Sets the
jcf up for further processing and link it to the created class. */
-void process_zip_dir()
+static void process_zip_dir()
{
int i;
ZipDirectory *zdir;
@@ -955,7 +956,7 @@ void process_zip_dir()
/* Lookup class NAME and figure whether is a class already found in the current
zip file. */
-int
+static int
DEFUN(find_in_current_zip, (name, length, jcf),
char *name AND JCF **jcf)
{
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index cc90341c4bf..71560e60616 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -23,9 +23,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h"
#include "system.h"
+#include "jcf.h"
#include "tree.h"
#include "java-tree.h"
-#include "jcf.h"
#include "obstack.h"
#undef AND
#include "rtl.h"
@@ -273,6 +273,33 @@ struct jcf_partial
};
static void generate_bytecode_insns PROTO ((tree, int, struct jcf_partial *));
+static struct chunk * alloc_chunk PROTO ((struct chunk *, unsigned char *,
+ int, struct obstack *));
+static unsigned char * append_chunk PROTO ((unsigned char *, int,
+ struct jcf_partial *));
+static void append_chunk_copy PROTO ((unsigned char *, int,
+ struct jcf_partial *));
+static struct jcf_block * gen_jcf_label PROTO ((struct jcf_partial *));
+static void finish_jcf_block PROTO ((struct jcf_partial *));
+static void define_jcf_label PROTO ((struct jcf_block *,
+ struct jcf_partial *));
+static struct jcf_block * get_jcf_label_here PROTO ((struct jcf_partial *));
+static void put_linenumber PROTO ((int, struct jcf_partial *));
+static void localvar_alloc PROTO ((tree, struct jcf_partial *));
+static int localvar_free PROTO ((tree, struct jcf_partial *));
+static int get_access_flags PROTO ((tree));
+static void write_chunks PROTO ((FILE *, struct chunk *));
+static int adjust_typed_op PROTO ((tree, int));
+static void generate_bytecode_conditional PROTO ((tree, struct jcf_block *,
+ struct jcf_block *, int,
+ struct jcf_partial *));
+static void generate_bytecode_return PROTO ((tree, struct jcf_partial *));
+static void perform_relocations PROTO ((struct jcf_partial *));
+static void init_jcf_state PROTO ((struct jcf_partial *, struct obstack *));
+static void init_jcf_method PROTO ((struct jcf_partial *, tree));
+static void release_jcf_state PROTO ((struct jcf_partial *));
+static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
+
/* Utility macros for appending (big-endian) data to a buffer.
We assume a local variable 'ptr' points into where we want to
@@ -304,7 +331,7 @@ CHECK_PUT(ptr, state, i)
Set the data and size fields to DATA and SIZE, respectively.
However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
-struct chunk *
+static struct chunk *
alloc_chunk (last, data, size, work)
struct chunk *last;
unsigned char *data;
@@ -339,7 +366,7 @@ CHECK_OP(struct jcf_partial *state)
#define CHECK_OP(STATE) ((void)0)
#endif
-unsigned char *
+static unsigned char *
append_chunk (data, size, state)
unsigned char *data;
int size;
@@ -351,7 +378,7 @@ append_chunk (data, size, state)
return state->chunk->data;
}
-void
+static void
append_chunk_copy (data, size, state)
unsigned char *data;
int size;
@@ -361,7 +388,7 @@ append_chunk_copy (data, size, state)
memcpy (ptr, data, size);
}
-struct jcf_block *
+static struct jcf_block *
gen_jcf_label (state)
struct jcf_partial *state;
{
@@ -373,7 +400,7 @@ gen_jcf_label (state)
return block;
}
-void
+static void
finish_jcf_block (state)
struct jcf_partial *state;
{
@@ -400,7 +427,7 @@ finish_jcf_block (state)
state->code_length = pc;
}
-void
+static void
define_jcf_label (label, state)
struct jcf_block *label;
struct jcf_partial *state;
@@ -417,7 +444,7 @@ define_jcf_label (label, state)
label->u.relocations = NULL;
}
-struct jcf_block *
+static struct jcf_block *
get_jcf_label_here (state)
struct jcf_partial *state;
{
@@ -433,7 +460,7 @@ get_jcf_label_here (state)
/* Note a line number entry for the current PC and given LINE. */
-void
+static void
put_linenumber (line, state)
int line;
struct jcf_partial *state;
@@ -493,7 +520,7 @@ struct localvar_info
#define localvar_max \
((struct localvar_info**) state->localvars.ptr - localvar_buffer)
-void
+static void
localvar_alloc (decl, state)
tree decl;
struct jcf_partial *state;
@@ -540,7 +567,7 @@ localvar_alloc (decl, state)
}
}
-int
+static int
localvar_free (decl, state)
tree decl;
struct jcf_partial *state;
@@ -571,7 +598,7 @@ localvar_free (decl, state)
/* Get the access flags of a class (TYPE_DECL), a method (FUNCTION_DECL), or
a field (FIELD_DECL or VAR_DECL, if static), as encoded in a .class file. */
-int
+static int
get_access_flags (decl)
tree decl;
{
@@ -624,7 +651,7 @@ get_access_flags (decl)
/* Write the list of segments starting at CHUNKS to STREAM. */
-void
+static void
write_chunks (stream, chunks)
FILE* stream;
struct chunk *chunks;
@@ -786,7 +813,7 @@ field_op (field, opcode, state)
reference) to 7 (for 'short') which matches the pattern of how JVM
opcodes typically depend on the operand type. */
-int
+static int
adjust_typed_op (type, max)
tree type;
int max;
@@ -940,7 +967,7 @@ emit_store (var, state)
static void
emit_unop (opcode, type, state)
enum java_opcode opcode;
- tree type;
+ tree type ATTRIBUTE_UNUSED;
struct jcf_partial *state;
{
RESERVE(1);
@@ -1044,7 +1071,7 @@ emit_jsr (target, state)
TRUE_LABEL may follow right after this. (The idea is that we
may be able to optimize away GOTO TRUE_LABEL; TRUE_LABEL:) */
-void
+static void
generate_bytecode_conditional (exp, true_label, false_label,
true_branch_first, state)
tree exp;
@@ -1268,7 +1295,7 @@ call_cleanups (limit, state)
}
}
-void
+static void
generate_bytecode_return (exp, state)
tree exp;
struct jcf_partial *state;
@@ -2448,7 +2475,7 @@ generate_bytecode_insns (exp, target, state)
}
}
-void
+static void
perform_relocations (state)
struct jcf_partial *state;
{
@@ -2616,7 +2643,7 @@ perform_relocations (state)
state->code_length = pc;
}
-void
+static void
init_jcf_state (state, work)
struct jcf_partial *state;
struct obstack *work;
@@ -2628,7 +2655,7 @@ init_jcf_state (state, work)
BUFFER_INIT (&state->bytecode);
}
-void
+static void
init_jcf_method (state, method)
struct jcf_partial *state;
tree method;
@@ -2651,7 +2678,7 @@ init_jcf_method (state, method)
state->return_value_decl = NULL_TREE;
}
-void
+static void
release_jcf_state (state)
struct jcf_partial *state;
{
@@ -2663,7 +2690,7 @@ release_jcf_state (state)
in the .class file representation. The list can be written to a
.class file using write_chunks. Allocate chunks from obstack WORK. */
-struct chunk *
+static struct chunk *
generate_classfile (clas, state)
tree clas;
struct jcf_partial *state;
@@ -2943,7 +2970,8 @@ static char *
make_class_file_name (clas)
tree clas;
{
- char *cname, *dname, *slash, *r;
+ const char *dname, *slash;
+ char *cname, *r;
struct stat sb;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h
index 4ec1fcd7de4..c8ab62b2596 100644
--- a/gcc/java/jcf.h
+++ b/gcc/java/jcf.h
@@ -224,7 +224,7 @@ typedef struct JCF {
#define DEFAULT_CLASS_PATH "."
extern char *find_class PROTO ((const char *, int, JCF*, int));
-extern char *find_classfile PROTO ((char *, JCF*, char *));
+extern char *find_classfile PROTO ((char *, JCF*, const char *));
extern int jcf_filbuf_from_stdio PROTO ((JCF *jcf, int count));
extern void jcf_out_of_synch PROTO((JCF *));
extern int jcf_unexpected_eof PROTO ((JCF*, int));
diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c
index af099ae4814..26fc662ed5e 100644
--- a/gcc/java/jv-scan.c
+++ b/gcc/java/jv-scan.c
@@ -27,7 +27,6 @@ Boston, MA 02111-1307, USA. */
void fatal VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void warning VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
void gcc_obstack_init PROTO ((struct obstack *obstack));
-extern void reset_report PROTO ((void));
#define JC1_LITE
#include "parse.h"
diff --git a/gcc/java/jvgenmain.c b/gcc/java/jvgenmain.c
index cc8823322de..0f9e6287827 100644
--- a/gcc/java/jvgenmain.c
+++ b/gcc/java/jvgenmain.c
@@ -28,6 +28,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h"
#include "obstack.h"
#include "gansidecl.h"
+#include "jcf.h"
+#include "tree.h"
+#include "java-tree.h"
const char main_method_prefix[] = "main__";
const char main_method_suffix[] = "Pt6JArray1ZPQ34java4lang6String";
@@ -35,11 +38,25 @@ const char class_mangling_prefix[] = "_CL_";
struct obstack name_obstack;
+extern void error PVPROTO ((const char *, ...))
+ ATTRIBUTE_PRINTF_1;
+
void
-error (const char *str)
+error VPROTO((const char *msgid, ...))
{
- fprintf (stderr, "%s\n", str);
- exit (-1);
+#ifndef ANSI_PROTOTYPES
+ const char *msgid;
+#endif
+ va_list ap;
+
+ VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+ msgid = va_arg (ap, const char *);
+#endif
+
+ vfprintf (stderr, msgid, ap);
+ va_end (ap);
}
void
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 42f35621576..f86640e921c 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -110,7 +110,8 @@ extern int flag_exceptions;
if `-fSTRING' is seen as an option.
(If `-fno-STRING' is seen as an option, the opposite value is stored.) */
-static struct { char *string; int *variable; int on_value;} lang_f_options[] =
+static struct { const char *string; int *variable; int on_value;}
+lang_f_options[] =
{
{"bounds-check", &flag_bounds_check, 1},
{"assume-compiled", &flag_assume_compiled, 1},
diff --git a/gcc/java/lex.c b/gcc/java/lex.c
index 54708adb08e..619bd3d67c4 100644
--- a/gcc/java/lex.c
+++ b/gcc/java/lex.c
@@ -61,7 +61,7 @@ static void java_lex_error PROTO ((char *, int));
static int java_is_eol PROTO ((FILE *, int));
#endif
static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
-static unicode_t java_parse_escape_sequence PROTO (());
+static unicode_t java_parse_escape_sequence PROTO ((void));
static int java_letter_or_digit_p PROTO ((unicode_t));
static int java_parse_doc_section PROTO ((unicode_t));
static void java_parse_end_comment PROTO ((unicode_t));
@@ -155,7 +155,7 @@ java_unget_unicode ()
ctxp->c_line->char_col -= JAVA_COLUMN_DELTA (0);
}
-void
+static void
java_allocate_new_line ()
{
unicode_t ahead = (ctxp->c_line ? ctxp->c_line->ahead[0] : '\0');
diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c
index 8014238f0d9..ebe680eb2e9 100644
--- a/gcc/java/mangle.c
+++ b/gcc/java/mangle.c
@@ -28,6 +28,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h"
#include "system.h"
#include "jcf.h"
+#include "tree.h"
+#include "java-tree.h"
#include "obstack.h"
#include "toplev.h"
@@ -37,15 +39,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
int
unicode_mangling_length (name, len)
- char *name;
+ const char *name;
int len;
{
- unsigned char *ptr;
- unsigned char *limit = (unsigned char *)name + len;
+ const unsigned char *ptr;
+ const unsigned char *limit = (const unsigned char *)name + len;
int need_escapes = 0;
int num_chars = 0;
int underscores = 0;
- for (ptr = (unsigned char *) name; ptr < limit; )
+ for (ptr = (const unsigned char *) name; ptr < limit; )
{
int ch = UTF8_GET(ptr, limit);
if (ch < 0)
@@ -70,12 +72,12 @@ unicode_mangling_length (name, len)
void
emit_unicode_mangled_name (obstack, name, len)
struct obstack *obstack;
- char *name;
+ const char *name;
int len;
{
- unsigned char *ptr;
- unsigned char *limit = (unsigned char *)name + len;
- for (ptr = (unsigned char *) name; ptr < limit; )
+ const unsigned char *ptr;
+ const unsigned char *limit = (const unsigned char *)name + len;
+ for (ptr = (const unsigned char *) name; ptr < limit; )
{
int ch = UTF8_GET(ptr, limit);
int emit_escape;
@@ -107,7 +109,7 @@ emit_unicode_mangled_name (obstack, name, len)
void
append_gpp_mangled_name (obstack, name, len)
struct obstack *obstack;
- char *name;
+ const char *name;
int len;
{
int encoded_len = unicode_mangling_length (name, len);
@@ -132,9 +134,9 @@ append_gpp_mangled_name (obstack, name, len)
void
append_gpp_mangled_classtype (obstack, class_name)
struct obstack *obstack;
- char *class_name;
+ const char *class_name;
{
- char *ptr;
+ const char *ptr;
int qualifications = 0;
for (ptr = class_name; *ptr != '\0'; ptr++)
diff --git a/gcc/java/parse.h b/gcc/java/parse.h
index f59c4ca4b42..bc453bbbf76 100644
--- a/gcc/java/parse.h
+++ b/gcc/java/parse.h
@@ -308,7 +308,7 @@ enum {
INVOKE_NONVIRTUAL,
INVOKE_SUPER,
INVOKE_INTERFACE,
- INVOKE_VIRTUAL,
+ INVOKE_VIRTUAL
};
/* We need the resolution stuff only if we compile jc1 */
@@ -357,7 +357,7 @@ enum jdep_code {
JDEP_TYPE, /* Patch a random tree node type,
without the need for any specific
actions */
- JDEP_EXCEPTION, /* Patch exceptions specified by `throws' */
+ JDEP_EXCEPTION /* Patch exceptions specified by `throws' */
};
typedef struct _jdep {
@@ -647,11 +647,12 @@ void java_check_circular_reference PROTO ((void));
void java_check_final PROTO ((void));
void java_layout_classes PROTO ((void));
tree java_method_add_stmt PROTO ((tree, tree));
-char *java_get_line_col PROTO ((char *, int, int));
void java_expand_switch PROTO ((tree));
int java_report_errors PROTO (());
extern tree do_resolve_class PROTO ((tree, tree, tree));
#endif
+char *java_get_line_col PROTO ((char *, int, int));
+extern void reset_report PROTO ((void));
/* Always in use, no matter what you compile */
void java_push_parser_context PROTO ((void));
diff --git a/gcc/java/verify.c b/gcc/java/verify.c
index 4b6ffffae44..fd0550e87db 100644
--- a/gcc/java/verify.c
+++ b/gcc/java/verify.c
@@ -33,6 +33,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "java-except.h"
#include "toplev.h"
+static void push_pending_label PROTO ((tree));
+static tree merge_types PROTO ((tree, tree));
+
extern int stack_pointer;
/* During verification, start of the current subroutine (jsr target). */
@@ -45,7 +48,7 @@ tree pending_blocks;
/* Append TARGET_LABEL to the pending_block stack unless already in it. */
-void
+static void
push_pending_label (target_label)
tree target_label;
{
@@ -102,7 +105,7 @@ check_pending_block (target_label)
For reference types, return the common super-class.
Return TYPE_UNKNOWN if the types cannot be merged. */
-tree
+static tree
merge_types (type1, type2)
tree type1, type2;
{
diff --git a/gcc/java/zipfile.h b/gcc/java/zipfile.h
index ccddaffe2ad..98a698ff821 100644
--- a/gcc/java/zipfile.h
+++ b/gcc/java/zipfile.h
@@ -57,5 +57,9 @@ extern struct ZipFileCache *SeenZipFiles;
((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size))
#define ZIPMAGIC 0x504b0304
-extern ZipFile * opendir_in_zip ();
+extern ZipFile * opendir_in_zip PROTO ((const char *, int));
extern int read_zip_archive PROTO ((ZipFile *));
+#ifdef JCF_ZIP
+extern int open_in_zip PROTO ((struct JCF *, const char *,
+ const char *, int));
+#endif