From c8e7d2e6329fc6b415b86764b55dc6fe56043b71 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Tue, 10 Aug 1999 16:58:13 +0000 Subject: check-init.c (check_bool2_init, [...]): Add static prototypes. * check-init.c (check_bool2_init, done_alternative): Add static prototypes. * class.c (add_interface_do, maybe_layout_super_class): Likewise. (add_method, build_utf8_ref, build_class_ref, append_gpp_mangled_type, layout_class_method): Constify a char*. * decl.c (push_promoted_type, make_binding_level): Add static prototypes. (push_promoted_type, pushdecl): Constify a char*. * except.c (find_handler_in_range, link_handler, check_start_handlers): Add static prototypes. * expr.c (process_jvm_instruction): Constify a char*. * gjavah.c (main): Constify a char*. * java-tree.h (verify_jvm_instructions, process_jvm_instruction): Constify a char*. * jcf-depend.c (free_entry, add_entry, munge, print_ents): Add static prototypes. (add_entry, jcf_dependency_set_target, jcf_dependency_add_target, munge, print_ents): Constify a char*. * jcf-dump.c (disassemble_method): Constify a char*. (print_constant_pool, print_exception_table): Add static prototypes. (print_constant, print_exception_table, main, disassemble_method): Constify a char*. * jcf-io.c (find_classfile, find_class): Likewise. * jcf-parse.c (JPOOL_UTF_DATA, find_in_current_zip): Likewise. (set_source_filename, predefined_filename_p): Add static prototypes. (set_source_filename, get_constant, get_class_constant, find_in_current_zip): Constify a char*. * jcf-path.c (free_entry, append_entry, add_entry, add_path): Add static prototypes. (add_entry, add_path, jcf_path_classpath_arg, jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*. * jcf-reader.c (get_attribute, jcf_parse_preamble, jcf_parse_constant_pool, jcf_parse_class, jcf_parse_fields, jcf_parse_one_method, jcf_parse_methods, jcf_parse_final_attributes): Add static prototypes. (get_attribute): Constify a char*. * jcf.h (find_class, find_classfile, jcf_dependency_set_target, jcf_dependency_add_target, jcf_path_classpath_arg, jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*. * jv-scan.c (main): Constify a char*. (gcc_obstack_init): Add prototype arguments. * jvgenmain.c (gcc_obstack_init): Likewise. (main): Constify a char*. * lang.c (put_decl_string, put_decl_node, java_dummy_print): Add static prototypes. (put_decl_string, lang_print_error): Constify a char*. (lang_init): Remove redundant extern prototype. * mangle.c (emit_unicode_mangled_name): Constify a char*. * typeck.c (convert_ieee_real_to_integer, parse_signature_type): Add static prototypes. (get_type_from_signature): Constify a char*. * verify.c (check_pending_block, type_stack_dup, start_pc_cmp ): Add static prototypes. (start_pc_cmp): Prefer PTR over GENERIC_PTR. (verify_jvm_instructions): Constify a char*. * xref.c (xref_flag_value): Likewise. * xref.h (xref_flag_value): Likewise. * zextract.c (makeword, makelong): Add static prototypes. (makeword, makelong): Constify a uch*. From-SVN: r28648 --- gcc/java/ChangeLog | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ gcc/java/check-init.c | 3 ++ gcc/java/class.c | 14 +++++---- gcc/java/decl.c | 8 +++-- gcc/java/except.c | 4 +++ gcc/java/expr.c | 2 +- gcc/java/gjavah.c | 3 +- gcc/java/java-tree.h | 4 +-- gcc/java/jcf-depend.c | 22 +++++++++----- gcc/java/jcf-dump.c | 23 ++++++++------ gcc/java/jcf-io.c | 6 ++-- gcc/java/jcf-parse.c | 18 ++++++----- gcc/java/jcf-path.c | 17 +++++++---- gcc/java/jcf-reader.c | 27 +++++++++++------ gcc/java/jcf.h | 14 ++++----- gcc/java/jv-scan.c | 6 ++-- gcc/java/jvgenmain.c | 6 ++-- gcc/java/lang.c | 9 ++++-- gcc/java/mangle.c | 2 +- gcc/java/typeck.c | 6 +++- gcc/java/verify.c | 9 ++++-- gcc/java/xref.c | 2 +- gcc/java/xref.h | 2 +- gcc/java/zextract.c | 11 +++++-- 24 files changed, 220 insertions(+), 82 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 525d6c4..7dc3f7c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,87 @@ +1999-08-10 Kaveh R. Ghazi + + * check-init.c (check_bool2_init, done_alternative): Add static + prototypes. + + * class.c (add_interface_do, maybe_layout_super_class): Likewise. + (add_method, build_utf8_ref, build_class_ref, + append_gpp_mangled_type, layout_class_method): Constify a char*. + + * decl.c (push_promoted_type, make_binding_level): Add static + prototypes. + (push_promoted_type, pushdecl): Constify a char*. + + * except.c (find_handler_in_range, link_handler, + check_start_handlers): Add static prototypes. + + * expr.c (process_jvm_instruction): Constify a char*. + + * gjavah.c (main): Constify a char*. + + * java-tree.h (verify_jvm_instructions, process_jvm_instruction): + Constify a char*. + + * jcf-depend.c (free_entry, add_entry, munge, print_ents): Add + static prototypes. + (add_entry, jcf_dependency_set_target, jcf_dependency_add_target, + munge, print_ents): Constify a char*. + + * jcf-dump.c (disassemble_method): Constify a char*. + (print_constant_pool, print_exception_table): Add static prototypes. + (print_constant, print_exception_table, main, disassemble_method): + Constify a char*. + + * jcf-io.c (find_classfile, find_class): Likewise. + + * jcf-parse.c (JPOOL_UTF_DATA, find_in_current_zip): Likewise. + (set_source_filename, predefined_filename_p): Add static prototypes. + (set_source_filename, get_constant, get_class_constant, + find_in_current_zip): Constify a char*. + + * jcf-path.c (free_entry, append_entry, add_entry, add_path): Add + static prototypes. + (add_entry, add_path, jcf_path_classpath_arg, + jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*. + + * jcf-reader.c (get_attribute, jcf_parse_preamble, + jcf_parse_constant_pool, jcf_parse_class, jcf_parse_fields, + jcf_parse_one_method, jcf_parse_methods, + jcf_parse_final_attributes): Add static prototypes. + (get_attribute): Constify a char*. + + * jcf.h (find_class, find_classfile, jcf_dependency_set_target, + jcf_dependency_add_target, jcf_path_classpath_arg, + jcf_path_CLASSPATH_arg, jcf_path_include_arg): Constify a char*. + + * jv-scan.c (main): Constify a char*. + (gcc_obstack_init): Add prototype arguments. + + * jvgenmain.c (gcc_obstack_init): Likewise. + (main): Constify a char*. + + * lang.c (put_decl_string, put_decl_node, java_dummy_print): Add + static prototypes. + (put_decl_string, lang_print_error): Constify a char*. + (lang_init): Remove redundant extern prototype. + + * mangle.c (emit_unicode_mangled_name): Constify a char*. + + * typeck.c (convert_ieee_real_to_integer, parse_signature_type): + Add static prototypes. + (get_type_from_signature): Constify a char*. + + * verify.c (check_pending_block, type_stack_dup, start_pc_cmp ): + Add static prototypes. + (start_pc_cmp): Prefer PTR over GENERIC_PTR. + (verify_jvm_instructions): Constify a char*. + + * xref.c (xref_flag_value): Likewise. + + * xref.h (xref_flag_value): Likewise. + + * zextract.c (makeword, makelong): Add static prototypes. + (makeword, makelong): Constify a uch*. + 1999-08-09 Kaveh R. Ghazi * lang.c (java_dummy_print): Constify a char*. diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index b92f3e8..31017a6 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -100,6 +100,9 @@ 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)); +static void check_bool2_init PROTO ((enum tree_code, tree, tree, words, words, words)); +struct alternatives; +static void done_alternative PROTO ((words, struct alternatives *)); #if 0 #define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word))) diff --git a/gcc/java/class.c b/gcc/java/class.c index 9a73364..295470a 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -45,6 +45,8 @@ 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 void add_interface_do PROTO ((tree, tree, int)); +static tree maybe_layout_super_class PROTO ((tree, tree)); static rtx registerClass_libfunc; @@ -448,7 +450,7 @@ add_method (this_class, access_flags, name, method_sig) { tree handle_class = CLASS_TO_HANDLE_TYPE (this_class); tree function_type, fndecl; - unsigned char *sig = (unsigned char*)IDENTIFIER_POINTER (method_sig); + const unsigned char *sig = (const unsigned char*)IDENTIFIER_POINTER (method_sig); push_obstacks (&permanent_obstack, &permanent_obstack); if (sig[0] != '(') fatal ("bad method signature"); @@ -555,7 +557,7 @@ tree build_utf8_ref (name) tree name; { - char* name_ptr = IDENTIFIER_POINTER(name); + const char * name_ptr = IDENTIFIER_POINTER(name); int name_len = IDENTIFIER_LENGTH(name); char buf[60]; char *buf_ptr; @@ -662,7 +664,7 @@ build_class_ref (type) } else { - char *name; + const char *name; char buffer[25]; if (flag_emit_class_files) { @@ -1329,7 +1331,7 @@ append_gpp_mangled_type (obstack, type) } else { - char *class_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); + const char *class_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); append_gpp_mangled_classtype (obstack, class_name); } break; @@ -1547,7 +1549,7 @@ tree layout_class_method (this_class, super_class, method_decl, dtable_count) tree this_class, super_class, method_decl, dtable_count; { - char *ptr; + const char *ptr; char *asm_name; tree arg, arglist, t; int method_name_needs_escapes = 0; @@ -1647,7 +1649,7 @@ layout_class_method (this_class, super_class, method_decl, dtable_count) if (method_name == init_identifier_node) { - char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class))); + const char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class))); for (ptr = p; *ptr; ) { if (*ptr++ == '.') diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 24696ee..6905cae 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -40,6 +40,8 @@ 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)); +static tree push_promoted_type PROTO ((const char *, tree)); +static struct binding_level *make_binding_level PROTO ((void)); #ifndef INT_TYPE_SIZE #define INT_TYPE_SIZE BITS_PER_WORD @@ -380,7 +382,7 @@ tree va_list_type_node; static tree push_promoted_type (name, actual_type) - char *name; + const char *name; tree actual_type; { tree type = make_node (TREE_CODE (actual_type)); @@ -940,7 +942,7 @@ pushdecl (x) DECL_CONTEXT (x) = current_function_decl; if (name) { - char *file; + const char *file; int line; t = lookup_name_current_level (name); @@ -1009,7 +1011,7 @@ pushdecl (x) /* No shadow warnings for vars made for inlining. */ && ! DECL_FROM_INLINE (x)) { - char *warnstring = 0; + const char *warnstring = 0; if (TREE_CODE (x) == PARM_DECL && current_binding_level->level_chain->parm_flag) diff --git a/gcc/java/except.c b/gcc/java/except.c index 1b02e7e..4c48fe7 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -39,6 +39,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ static void expand_start_java_handler PROTO ((struct eh_range *)); static void expand_end_java_handler PROTO ((struct eh_range *)); +static struct eh_range *find_handler_in_range PROTO ((int, struct eh_range *, + struct eh_range *)); +static void link_handler PROTO ((struct eh_range *, struct eh_range *)); +static void check_start_handlers PROTO ((struct eh_range *, int)); extern struct obstack permanent_obstack; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 59376a1..1fed31d 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2315,7 +2315,7 @@ java_push_constant_from_pool (jcf, index) int process_jvm_instruction (PC, byte_ops, length) int PC; - unsigned char* byte_ops; + const unsigned char* byte_ops; long length ATTRIBUTE_UNUSED; { const char *opname; /* Temporary ??? */ diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c index b680a87..72b6be1 100644 --- a/gcc/java/gjavah.c +++ b/gcc/java/gjavah.c @@ -1652,7 +1652,8 @@ DEFUN(main, (argc, argv), for (; argi < argc; argi++) { char *classname = argv[argi]; - char *classfile_name, *current_output_file; + char *current_output_file; + const char *classfile_name; if (verbose) fprintf (stderr, "Processing %s\n", classname); diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index dfa17a2..f34b5f2 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -598,10 +598,10 @@ extern void push_super_field PROTO ((tree, tree)); extern void init_class_processing PROTO ((void)); extern int can_widen_reference_to PROTO ((tree, tree)); extern int class_depth PROTO ((tree)); -extern int verify_jvm_instructions PROTO ((struct JCF *, unsigned char *, long)); +extern int verify_jvm_instructions PROTO ((struct JCF *, const unsigned char *, long)); extern void maybe_pushlevels PROTO ((int)); extern void maybe_poplevels PROTO ((int)); -extern int process_jvm_instruction PROTO ((int, unsigned char *, long)); +extern int process_jvm_instruction PROTO ((int, const unsigned char *, long)); extern void set_local_type PROTO ((int, tree)); extern int merge_type_state PROTO ((tree)); extern void push_type PROTO ((tree)); diff --git a/gcc/java/jcf-depend.c b/gcc/java/jcf-depend.c index 86b9d77..87b474c 100644 --- a/gcc/java/jcf-depend.c +++ b/gcc/java/jcf-depend.c @@ -39,6 +39,11 @@ struct entry struct entry *next; }; +static void free_entry PROTO ((struct entry **)); +static void add_entry PROTO ((struct entry **, const char *)); +static const char *munge PROTO ((const char *)); +static int print_ents PROTO ((struct entry *, int)); + /* List of files. */ static struct entry *dependencies = NULL; @@ -77,7 +82,7 @@ free_entry (entp) static void add_entry (entp, name) struct entry **entp; - char *name; + const char *name; { struct entry *ent; @@ -110,7 +115,7 @@ jcf_dependency_reset () void jcf_dependency_set_target (name) - char *name; + const char *name; { free_entry (&targets); if (name != NULL) @@ -119,7 +124,7 @@ jcf_dependency_set_target (name) void jcf_dependency_add_target (name) - char *name; + const char *name; { add_entry (&targets, name); } @@ -158,15 +163,16 @@ jcf_dependency_init (system_p) /* FIXME: this is taken almost directly from cccp.c. Such duplication is bad. */ -static char * +static const char * munge (filename) - char *filename; + const char *filename; { static char *buffer = NULL; static int buflen = 0; int len = 2 * strlen (filename) + 1; - char *p, *dst; + const char *p; + char *dst; if (buflen < len) { @@ -191,7 +197,7 @@ munge (filename) preceded by 2N backslashes represents N backslashes at the end of a file name; and backslashes in other contexts should not be doubled. */ - char *q; + const char *q; for (q = p - 1; filename < q && q[-1] == '\\'; q--) *dst++ = '\\'; } @@ -228,7 +234,7 @@ print_ents (ent, column) for (; ent != NULL; ent = ent->next) { - char *depname = munge (ent->file); + const char *depname = munge (ent->file); int len = strlen (depname); if (column + len + 2 > MAX_OUTPUT_COLUMNS) diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c index a26a6fb..676a751 100644 --- a/gcc/java/jcf-dump.c +++ b/gcc/java/jcf-dump.c @@ -82,12 +82,15 @@ static void print_access_flags PROTO ((FILE *, uint16, char)); static void print_constant_terse PROTO ((FILE*, JCF*, int, int)); static void print_constant PROTO ((FILE *, JCF *, int, int)); static void print_constant_ref PROTO ((FILE *, JCF *, int)); -static void disassemble_method PROTO ((JCF*, unsigned char *, int)); +static void disassemble_method PROTO ((JCF*, const 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 *)); +static void print_constant_pool PROTO ((struct JCF *)); +static void print_exception_table PROTO ((struct JCF *, + const unsigned char *entries, int)); #define PRINT_SIGNATURE_RESULT_ONLY 1 #define PRINT_SIGNATURE_ARGS_ONLY 2 @@ -482,7 +485,7 @@ DEFUN(print_constant, (out, jcf, index, verbosity), break; case CONSTANT_Utf8: { - register unsigned char *str = JPOOL_UTF_DATA (jcf, index); + register const unsigned char *str = JPOOL_UTF_DATA (jcf, index); int length = JPOOL_UTF_LENGTH (jcf, index); if (verbosity > 0) { /* Print as 8-bit bytes. */ @@ -503,7 +506,7 @@ DEFUN(print_constant, (out, jcf, index, verbosity), } } -void +static void DEFUN(print_constant_pool, (jcf), JCF *jcf) { @@ -630,13 +633,13 @@ DEFUN(print_signature, (stream, jcf, signature_index, int options), static void DEFUN(print_exception_table, (jcf, entries, count), - JCF *jcf AND unsigned char *entries AND int count) + JCF *jcf AND const unsigned char *entries AND int count) { /* Print exception table. */ int i = count; if (i > 0) { - unsigned char *ptr = entries; + const unsigned char *ptr = entries; fprintf (out, "Exceptions (count: %d):\n", i); for (; --i >= 0; ptr+= 8) { @@ -726,7 +729,7 @@ DEFUN(main, (argc, argv), for (argi = 1; argi < argc; argi++) { - char *arg = argv[argi]; + const char *arg = argv[argi]; if (arg[0] != '-' || ! strcmp (arg, "--")) break; @@ -802,7 +805,7 @@ DEFUN(main, (argc, argv), for (; argi < argc; argi++) { char *arg = argv[argi]; - char* class_filename = find_class (arg, strlen (arg), jcf, 0); + const char *class_filename = find_class (arg, strlen (arg), jcf, 0); if (class_filename == NULL) class_filename = find_classfile (arg, jcf, NULL); if (class_filename == NULL) @@ -816,7 +819,7 @@ DEFUN(main, (argc, argv), long compressed_size, member_size; int compression_method, filename_length, extra_length; int general_purpose_bits; - char *filename; + const char *filename; int total_length; if (flag_print_class_info) fprintf (out, "Reading classes from archive %s.\n", @@ -910,7 +913,7 @@ DEFUN(main, (argc, argv), static void DEFUN(disassemble_method, (jcf, byte_ops, len), - JCF* jcf AND unsigned char *byte_ops AND int len) + JCF* jcf AND const unsigned char *byte_ops AND int len) { #undef AND /* Causes problems with opcodes for iand and land. */ #undef PTR @@ -999,7 +1002,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), #define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE #define ARRAY_NEW_NUM \ INT_temp = IMMEDIATE_u1; \ - { char *str; \ + { const char *str; \ switch (INT_temp) { \ case 4: str = "boolean"; break; \ case 5: str = "char"; break; \ diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index 9533218..765f150 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -240,7 +240,7 @@ DEFUN(open_class, (filename, jcf, fd, dep_name), #endif -char * +const char * DEFUN(find_classfile, (filename, jcf, dep_name), char *filename AND JCF *jcf AND const char *dep_name) { @@ -262,7 +262,7 @@ DEFUN(find_classfile, (filename, jcf, dep_name), failure. If JCF != NULL, it is suitably initialized. SOURCE_OK is true if we should also look for .java file. */ -char * +const char * DEFUN(find_class, (classname, classname_length, jcf, source_ok), const char *classname AND int classname_length AND JCF *jcf AND int source_ok) @@ -290,7 +290,7 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok), for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) { - char *path_name = jcf_path_name (entry); + const char *path_name = jcf_path_name (entry); if (class != 0) { int dir_len; diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 054c239..78daf2d 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -39,7 +39,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #define JPOOL_UTF(JCF, INDEX) CPOOL_UTF(&(JCF)->cpool, INDEX) #define JPOOL_UTF_LENGTH(JCF, INDEX) IDENTIFIER_LENGTH (JPOOL_UTF (JCF, INDEX)) #define JPOOL_UTF_DATA(JCF, INDEX) \ - ((unsigned char*) IDENTIFIER_POINTER (JPOOL_UTF (JCF, INDEX))) + ((const unsigned char *) IDENTIFIER_POINTER (JPOOL_UTF (JCF, INDEX))) #define HANDLE_CONSTANT_Utf8(JCF, INDEX, LENGTH) \ do { \ unsigned char save; unsigned char *text; \ @@ -87,12 +87,14 @@ 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 int find_in_current_zip PROTO ((const char *, struct JCF **)); static void parse_class_file PROTO ((void)); +static void set_source_filename PROTO ((JCF *, int)); +static int predefined_filename_p PROTO ((tree)); /* Handle "SourceFile" attribute. */ -void +static void set_source_filename (jcf, index) JCF *jcf; int index; @@ -303,10 +305,10 @@ get_constant (jcf, index) { extern struct obstack *expression_obstack; tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); - char *utf8_ptr = IDENTIFIER_POINTER (name); + const char *utf8_ptr = IDENTIFIER_POINTER (name); unsigned char *str_ptr; int utf8_len = IDENTIFIER_LENGTH (name); - unsigned char *str = (unsigned char*)utf8_ptr; + const unsigned char *str = (const unsigned char *)utf8_ptr; int i = utf8_len; int str_len; @@ -327,7 +329,7 @@ get_constant (jcf, index) TREE_STRING_POINTER (value) = obstack_alloc (expression_obstack, 2 * str_len); str_ptr = (unsigned char *) TREE_STRING_POINTER (value); - str = (unsigned char*)utf8_ptr; + str = (const unsigned char *)utf8_ptr; for (i = 0; i < str_len; i++) { int char_value; @@ -426,7 +428,7 @@ get_class_constant (JCF *jcf , int i) { int name_index = JPOOL_USHORT1 (jcf, i); /* verify_constant_pool confirmed that name_index is a CONSTANT_Utf8. */ - char *name = JPOOL_UTF_DATA (jcf, name_index); + const char *name = JPOOL_UTF_DATA (jcf, name_index); int nlength = JPOOL_UTF_LENGTH (jcf, name_index); if (name[0] == '[') /* Handle array "classes". */ type = TREE_TYPE (parse_signature_string (name, nlength)); @@ -1007,7 +1009,7 @@ static void process_zip_dir() zip file. */ static int DEFUN(find_in_current_zip, (name, length, jcf), - char *name AND JCF **jcf) + const char *name AND JCF **jcf) { JCF *local_jcf; tree class_name = maybe_get_identifier (name), class, icv; diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c index 67dd02e..c92cf14 100644 --- a/gcc/java/jcf-path.c +++ b/gcc/java/jcf-path.c @@ -58,6 +58,11 @@ struct entry struct entry *next; }; +static void free_entry PROTO ((struct entry **)); +static void append_entry PROTO ((struct entry **, struct entry *)); +static void add_entry PROTO ((struct entry **, const char *, int)); +static void add_path PROTO ((struct entry **, const char *, int)); + /* We support several different ways to set the class path. built-in system directory (only libgcj.zip) @@ -130,7 +135,7 @@ append_entry (entp, ent) static void add_entry (entp, filename, is_system) struct entry **entp; - char *filename; + const char *filename; int is_system; { int len; @@ -177,10 +182,10 @@ add_entry (entp, filename, is_system) static void add_path (entp, cp, is_system) struct entry **entp; - char *cp; + const char *cp; int is_system; { - char *startp, *endp; + const char *startp, *endp; if (cp) { @@ -229,7 +234,7 @@ jcf_path_init () /* Call this when -classpath is seen on the command line. */ void jcf_path_classpath_arg (path) - char *path; + const char *path; { free_entry (&classpath_l); add_path (&classpath_l, path, 0); @@ -238,7 +243,7 @@ jcf_path_classpath_arg (path) /* Call this when -CLASSPATH is seen on the command line. */ void jcf_path_CLASSPATH_arg (path) - char *path; + const char *path; { free_entry (&classpath_u); add_path (&classpath_u, path, 0); @@ -247,7 +252,7 @@ jcf_path_CLASSPATH_arg (path) /* Call this when -I is seen on the command line. */ void jcf_path_include_arg (path) - char *path; + const char *path; { add_entry (&include_dirs, path, 0); } diff --git a/gcc/java/jcf-reader.c b/gcc/java/jcf-reader.c index c6207a2..44fb37e 100644 --- a/gcc/java/jcf-reader.c +++ b/gcc/java/jcf-reader.c @@ -26,7 +26,16 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "jcf.h" #include "zipfile.h" -int +static int get_attribute PROTO((JCF *)); +static int jcf_parse_preamble PROTO((JCF *)); +static int jcf_parse_constant_pool PROTO((JCF *)); +static void jcf_parse_class PROTO((JCF *)); +static int jcf_parse_fields PROTO((JCF *)); +static int jcf_parse_one_method PROTO((JCF *)); +static int jcf_parse_methods PROTO((JCF *)); +static int jcf_parse_final_attributes PROTO((JCF *)); + +static int DEFUN(get_attribute, (jcf), JCF *jcf) { @@ -34,7 +43,7 @@ DEFUN(get_attribute, (jcf), uint32 attribute_length = JCF_readu4 (jcf); uint32 start_pos = JCF_TELL(jcf); int name_length; - unsigned char *name_data; + const unsigned char *name_data; JCF_FILL (jcf, (long) attribute_length); if (attribute_name <= 0 || attribute_name >= JPOOL_SIZE(jcf)) return -2; @@ -134,7 +143,7 @@ DEFUN(get_attribute, (jcf), } /* Read and handle the pre-amble. */ -int +static int DEFUN(jcf_parse_preamble, (jcf), JCF* jcf) { @@ -155,7 +164,7 @@ DEFUN(jcf_parse_preamble, (jcf), Return 0 if OK. Return -2 if a bad cross-reference (index of other constant) was seen. */ -int +static int DEFUN(jcf_parse_constant_pool, (jcf), JCF* jcf) { @@ -221,7 +230,7 @@ DEFUN(jcf_parse_constant_pool, (jcf), /* Read various class flags and numbers. */ -void +static void DEFUN(jcf_parse_class, (jcf), JCF* jcf) { @@ -250,7 +259,7 @@ DEFUN(jcf_parse_class, (jcf), } /* Read fields. */ -int +static int DEFUN(jcf_parse_fields, (jcf), JCF* jcf) { @@ -290,7 +299,7 @@ DEFUN(jcf_parse_fields, (jcf), /* Read methods. */ -int +static int DEFUN(jcf_parse_one_method, (jcf), JCF* jcf) { @@ -314,7 +323,7 @@ DEFUN(jcf_parse_one_method, (jcf), return 0; } -int +static int DEFUN(jcf_parse_methods, (jcf), JCF* jcf) { @@ -338,7 +347,7 @@ DEFUN(jcf_parse_methods, (jcf), } /* Read attributes. */ -int +static int DEFUN(jcf_parse_final_attributes, (jcf), JCF *jcf) { diff --git a/gcc/java/jcf.h b/gcc/java/jcf.h index c8ab62b..56b35a5 100644 --- a/gcc/java/jcf.h +++ b/gcc/java/jcf.h @@ -223,8 +223,8 @@ typedef struct JCF { #define DEFAULT_CLASS_PATH "." -extern char *find_class PROTO ((const char *, int, JCF*, int)); -extern char *find_classfile PROTO ((char *, JCF*, const char *)); +extern const char *find_class PROTO ((const char *, int, JCF*, int)); +extern const 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)); @@ -259,8 +259,8 @@ extern int quiet_flag; /* Declarations for dependency code. */ extern void jcf_dependency_reset PROTO ((void)); -extern void jcf_dependency_set_target PROTO ((char *)); -extern void jcf_dependency_add_target PROTO ((char *)); +extern void jcf_dependency_set_target PROTO ((const char *)); +extern void jcf_dependency_add_target PROTO ((const char *)); extern void jcf_dependency_set_dep_file PROTO ((const char *)); extern void jcf_dependency_add_file PROTO ((const char *, int)); extern void jcf_dependency_write PROTO ((void)); @@ -268,9 +268,9 @@ extern void jcf_dependency_init PROTO ((int)); /* Declarations for path handling code. */ extern void jcf_path_init PROTO ((void)); -extern void jcf_path_classpath_arg PROTO ((char *)); -extern void jcf_path_CLASSPATH_arg PROTO ((char *)); -extern void jcf_path_include_arg PROTO ((char *)); +extern void jcf_path_classpath_arg PROTO ((const char *)); +extern void jcf_path_CLASSPATH_arg PROTO ((const char *)); +extern void jcf_path_include_arg PROTO ((const char *)); extern void jcf_path_seal PROTO ((void)); extern void *jcf_path_start PROTO ((void)); extern void *jcf_path_next PROTO ((void *)); diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c index 26fc662..df660ac 100644 --- a/gcc/java/jv-scan.c +++ b/gcc/java/jv-scan.c @@ -52,7 +52,7 @@ main (argc, argv) char **argv; { int i = 1; - char *output_file = NULL; + const char *output_file = NULL; long ft; exec_name = argv[0]; @@ -197,8 +197,8 @@ gcc_obstack_init (obstack) #define OBSTACK_CHUNK_FREE free #endif _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0, - (void *(*) ()) OBSTACK_CHUNK_ALLOC, - (void (*) ()) OBSTACK_CHUNK_FREE); + (void *(*) (long)) OBSTACK_CHUNK_ALLOC, + (void (*) (void *)) OBSTACK_CHUNK_FREE); } PTR diff --git a/gcc/java/jvgenmain.c b/gcc/java/jvgenmain.c index 0f9e628..8422fbc 100644 --- a/gcc/java/jvgenmain.c +++ b/gcc/java/jvgenmain.c @@ -75,8 +75,8 @@ gcc_obstack_init (obstack) #define OBSTACK_CHUNK_FREE free #endif _obstack_begin (obstack, OBSTACK_CHUNK_SIZE, 0, - (void *(*) ()) OBSTACK_CHUNK_ALLOC, - (void (*) ()) OBSTACK_CHUNK_FREE); + (void *(*) PROTO((long))) OBSTACK_CHUNK_ALLOC, + (void (*) PROTO((void *))) OBSTACK_CHUNK_FREE); } int @@ -84,7 +84,7 @@ main (int argc, const char **argv) { const char *classname; FILE *stream; - char *mangled_classname; + const char *mangled_classname; if (argc < 2 || argc > 3) { diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 28fdc6d..3287575 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -36,6 +36,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "flags.h" #include "xref.h" +static void put_decl_string PROTO ((const char *, int)); +static void put_decl_node PROTO ((tree)); +static void java_dummy_print PROTO ((const char *)); + #ifndef OBJECT_SUFFIX # define OBJECT_SUFFIX ".o" #endif @@ -337,7 +341,7 @@ static int decl_bufpos = 0; static void put_decl_string (str, len) - char *str; + const char *str; int len; { if (len < 0) @@ -475,7 +479,7 @@ lang_print_error (file) fprintf (stderr, "At top level:\n"); else { - char *name = lang_printable_name (current_function_decl, 2); + const char *name = lang_printable_name (current_function_decl, 2); fprintf (stderr, "In method `%s':\n", name); } @@ -487,7 +491,6 @@ lang_print_error (file) void lang_init () { - extern struct rtx_def * (*lang_expand_expr) (); #if 0 extern int flag_minimal_debug; flag_minimal_debug = 0; diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c index ebe680e..d38a23a 100644 --- a/gcc/java/mangle.c +++ b/gcc/java/mangle.c @@ -87,7 +87,7 @@ emit_unicode_mangled_name (obstack, name, len) break; } if (ch >= '0' && ch <= '9') - emit_escape = (ptr == (unsigned char*) name); + emit_escape = (ptr == (const unsigned char *) name); else emit_escape = (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'); if (emit_escape) diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 99536ff..c6c1708 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -34,6 +34,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "convert.h" #include "toplev.h" +static tree convert_ieee_real_to_integer PROTO ((tree, tree)); +static tree parse_signature_type PROTO ((const unsigned char **, + const unsigned char *)); + tree * type_map; extern struct obstack permanent_obstack; @@ -546,7 +550,7 @@ parse_signature_string (sig_string, sig_length) tree get_type_from_signature (tree signature) { - unsigned char *sig = (unsigned char *) IDENTIFIER_POINTER (signature); + const unsigned char *sig = (const unsigned char *) IDENTIFIER_POINTER (signature); int len = IDENTIFIER_LENGTH (signature); tree type; /* Primitive types aren't cached. */ diff --git a/gcc/java/verify.c b/gcc/java/verify.c index 9e11d76..07556e8 100644 --- a/gcc/java/verify.c +++ b/gcc/java/verify.c @@ -35,6 +35,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ static void push_pending_label PROTO ((tree)); static tree merge_types PROTO ((tree, tree)); +static const char *check_pending_block PROTO ((tree)); +static void type_stack_dup PROTO ((int, int)); +static int start_pc_cmp PROTO ((const PTR, const PTR)); extern int stack_pointer; @@ -310,8 +313,8 @@ struct pc_index /* A helper that is used when sorting exception ranges. */ static int start_pc_cmp (xp, yp) - const GENERIC_PTR xp; - const GENERIC_PTR yp; + const PTR xp; + const PTR yp; { struct pc_index *x = (struct pc_index *) xp; struct pc_index *y = (struct pc_index *) yp; @@ -344,7 +347,7 @@ start_pc_cmp (xp, yp) int verify_jvm_instructions (jcf, byte_ops, length) JCF* jcf; - unsigned char* byte_ops; + const unsigned char *byte_ops; long length; { tree label; diff --git a/gcc/java/xref.c b/gcc/java/xref.c index 8fd5180..57241c6 100644 --- a/gcc/java/xref.c +++ b/gcc/java/xref.c @@ -42,7 +42,7 @@ static xref_flag_table xref_table [] = { int xref_flag_value (flag) - char *flag; + const char *flag; { int i; for (i = 0; xref_table [i].key; i++) diff --git a/gcc/java/xref.h b/gcc/java/xref.h index 7a98834..f0db4ef 100644 --- a/gcc/java/xref.h +++ b/gcc/java/xref.h @@ -24,7 +24,7 @@ of Sun Microsystems, Inc. in the United States and other countries. The Free Software Foundation is independent of Sun Microsystems, Inc. */ /* Exported functions. */ -int xref_flag_value PROTO ((char *)); +int xref_flag_value PROTO ((const char *)); void expand_xref PROTO ((tree)); void xref_set_data PROTO ((int, void *)); void *xref_get_data PROTO ((int)); diff --git a/gcc/java/zextract.c b/gcc/java/zextract.c index 5e170b3..59fe486 100644 --- a/gcc/java/zextract.c +++ b/gcc/java/zextract.c @@ -207,11 +207,18 @@ typedef unsigned long ulg; /* predefined on some systems) & match zip */ /***********************/ +/* Prototypes */ +/***********************/ + +static ush makeword PROTO ((const uch *)); +static ulg makelong PROTO ((const uch *)); + +/***********************/ /* Function makeword() */ /***********************/ static ush makeword(b) - uch *b; + const uch *b; { /* * Convert Intel style 'short' integer to non-Intel non-16-bit @@ -226,7 +233,7 @@ static ush makeword(b) /***********************/ static ulg makelong(sig) - uch *sig; + const uch *sig; { /* * Convert intel style 'long' variable to non-Intel non-16-bit -- cgit v1.1