Commit Graph

43 Commits

Author SHA1 Message Date
Zack Weinberg
74d04dd13b * verify.c: Don't use // comments.
From-SVN: r43840
2001-07-07 18:26:11 +00:00
Kaveh R. Ghazi
962584ea56 jcf-io.c (read_zip_member): Cast to long in comparison with signed value.
* jcf-io.c (read_zip_member): Cast to long in comparison with
	signed value.

	* jvspec.c (lang_specific_driver): Initialize variables.

	* mangle.c (find_compression_record_match): Likewise.

	* typeck.c (build_null_signature): Provide static prototype.  Mark
	parameter with ATTRIBUTE_UNUSED.

	* verify.c (verify_jvm_instructions): Initialize variable.

From-SVN: r41671
2001-04-29 11:24:37 +00:00
Per Bothner
5acea42bfb verify.c (verify_jvm_instructions): For field instructions, check that field index is valid.
* verify.c (verify_jvm_instructions):  For field instructions,
	check that field index is valid.  For invoke instructions, check that
	method index is valid.

From-SVN: r41600
2001-04-26 11:11:02 -07:00
Per Bothner
fa029f453a re PR java/1208 (Gcj can't compile a class file it generates.)
e
	* verify.c (verify_jvm_instructions):  Replace 3 pop_type by POP_TYPE
	macro for better error pin-pointing.
	* java-tree.h:  Fix typo in comment.

	* jcf-write.c (generate_bytecode_insns):  Changes to TRY_FINALLY_EXPR.
	Don't include jsr/goto in exception range.
	Check if start and end of exception range are the same (also TRY_EXPR).
	Don't emit jsr after try_block if CAN_COMPLETE_NORMALLY is false.
	However, do emit the following goto even if try_block is empty.
	Defer freeing exception_decl until after the finalizer, to make
	sure the local isn't reused in the finalizer.  Fixes PR java/1208.

	* parse.y (java_complete_lhs):  If the try-clause is empty, just
	return the finally-clause and vice versa.

From-SVN: r40801
2001-03-23 17:13:30 -08:00
Per Bothner
19f8e04bff verify.c (verify_jvm_instructions): Better error msgs for dup.
* verify.c (verify_jvm_instructions):  Better error msgs for dup.
	(type_stack_dup):  Remove no-longer neded error check.

From-SVN: r40529
2001-03-15 20:16:54 -08:00
Richard Kenner
400500c4a5 diagnostic.h (set_internal_error_function): Renamed.
* diagnostic.h (set_internal_error_function): Renamed.
	* toplev.h (internal_error): Renamed from fatal.
	(pfatal_with_name): Deleted.
	(fatal_io_error): Now has printf-style arguments.
	* diagnostic.c (pfatal_with_name): Deleted.
	(fatal_io_error): Rework to have args in printf-style.
	(set_internal_error_function): Renamed from set_fatal_function.
	(internal_error): Renamed from fatal.
	(error_recursion, fancy_abort): Call internal_error instead of fatal.
	* dwarf2out.c (get_cfa_from_loc_descr): Likewise.
	* emit-rtl.c (gen_realpart, gen_imagpart): Likewise.
	* expr.c (check_max_integer_computation_mode, expand_expr): Likewise.
	* flow.c (verify_flow_info): Likewise.
	* config/arm/arm.c (thumb_unexpanded_epilogue): Likewise.
	* config/mips/mips.c (save_restore_insns): Likewise.
	* cp/init.c (build_java_class_ref): Likewise.
	(dsp16xx_reg_class_from_letter): Likewise.
	(limit_reload_class, double_reg_to_memory): Likewise.
	(print_operand_address, emit_1600_code_shift): Likewise.
	(gen_tst_reg, gen_compare_reg): Likewise.
	* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
	* cp/decl.c (pushdecl): Likewise.
	* java/check-init.c (check_init): Likewise.
	* java/expr.c (java_lang_expand_expr): Likewise.
	* java/jcf-parse.c (get_constant): Likewise.
	* java/mangle.c (java_mangle_decl): Likewise.
	* java/parse.y (make_nested_class_name, java_complete_lhs): Likewise.
	(operator_string): Likewise.

	* except.c (duplicate_eh_handlers): Call abort instead of fatal.
	* flow.c (verify_flow_info): Likewise.
	* ch/convert.c (convert): Likewise.
	* ch/except.c (pop_handler, chill_check_no_handlers): Likewise.
	* ch/expr.c (chill_expand_expr): Likewise.
	* ch/parse.c (peek_token_, pushback_token, require): Likewise.
	* config/arm/arm.c (thumb_load_double_from_address): Likewise.
	* config/avr/avr.c (pttreg_to_str, unique_section): Likewise.
	(avr_normalize_condition): Likewise.
	* config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise.
	* config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise.
	(limit_reload_class, double_reg_to_memory): Likewise.
	(print_operand_address, emit_1600_code_shift): Likewise.
	(gen_tst_reg, gen_compare_reg): Likewise.
	* config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise.
	* cp/decl.c (pushdecl): Likewise.
	* java/check-init.c (check_init): Likewise.
	* java/class.c (build_class_ref): Likewise.
	* java/constants.c (write_constant_pool): Likewise.
	* java/decl.c (start_java_method): Likewise.
	* java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise.
	(java_stack_dup, encode_newarray_type): Likewise.
	(build_java_array_length_access): Likewise.
	(build_java_check_indexed_type, expand_java_pushc): Likewise.
	(build_java_soft_divmod, build_invokeinterface): Likewise.
	* java/java-tree.h (INNER_CLASS_P): Likewise.
	* java/jcf-parse.c (parse_signature, get_name_constant): Likewise.
	(give_name_to_class, get_class_constant): Likewise.
	* java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise.
	(find_constant_index, generate_bytecode_conditional): Likewise.
	(generate_bytecode_insns, perform_relocations): Likewise.
	* java/lex.c (java_unget_unicode, java_lex): Likewise.
	* java/mangle.c (mangle_type, mangle_record_type): Likewise.
	(mangle_pointer_type, mangle_array_type, init_mangling): Likewise.
	(finish_mangling): Likewise.
	* java/parse.h (MARK_FINAL_PARMS): Likewise.
	* java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise.
	(obtain_incomplete_type, java_complete_class): Likewise.
	(java_check_regular_methods, java_complete_expand_method): Likewise.
	(cut_identifier_in_qualified, check_deprecation): Likewise.
	(patch_invoke, find_applicable_accessible_methods_list): Likewise.
	(java_complete_lhs, lookup_name_in_blocks): Likewise.
	(check_final_variable_indirect_assignment, build_unaryop): Likewise.
	* java/typeck.c (set_local_type, parse_signature_type): Likewise.
	(parse_signature_string, build_java_signature): Likewise;
	(set_java_signature): Likewise.
	* java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise.

	* c-parse.in (methoddef): Call fatal_error instead of fatal.
	* objc/objc-act.c (build_ivar_chain): Likewise.
	* cp/except.c (decl_is_java_type): Likewise.
	* cp/init.c (build_java_class_ref): Likewise.
	* cp/init.c (build_new_1): Likewise.
	* f/com.c (ffecom_init_0): Likewise.
	* java/class.c (add_method, build_static_field_ref): Likewise.
	* java/expr.c (build_known_method_ref, expand_invoke): Likewise.
	* java/jcf-parse.c (get_constant, jcf_parse): Likewise.
	* java/lex.c (java_new_new_lexer): Likewise.
	* java/jv-scan.c (main): Likewise.
	(fatal_error): Renamed from fatal.

	* dwarfout.c (dwarfout_init): Call fatal_io_error instead of
	pfatal_with_name.
	* graph.c (clean_graph_dump_file): Likewise.
	* profile.c (init_branch_prob): Likewise.
	* ch/grant.c (write_grant_file): Likewise.
	* ch/lex.c (init_parse, same_file, yywrap): Likewise.
	* f/com.c (init_parse): Likewise.
	* java/jcf-parse.c (yyparse): Likewise.
	* objc/objc-act.c (objc_init): Likewise.

	* java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal.
	(yyparse): Likewise.
	* java/jcf-write.c (make_class_file_name, write_classfile): Likewise.
	* java/lex.c (java_get_line_col): Likewise.

	* hash.c (hash_allocate): Don't check for failure returns from
	obstack functions that can't fail.
	(hash_table_init_n, hash_table_init): Likewise; also now return void.
	* hash.h (hash_table_init_n, hash_table_init): Now return void.
	* cp/decl.c (build_typename_type): hash_table_init now returns void.

	* ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted.
	* ch/lex.c (convert_bitstring): Delete check for alloca failure.
	* config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare):
	Deleted.
	* config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it.

	* f/com.c (ffecom_decode_include_option_): Make errors non-fatal.
	* f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise.
	(ffelex_hash_): Likewise.
	* config/arm/arm.c (arm_override_options): Likewise.
	* config/avr/avr.c (avr_override_options): Likewise.
	* config/c4x/c4x.c (c4x_expand_prologue): Likewise.
	* config/dsp16xx/dsp16xx.c (function_prologue): Likewise.
	* config/h8300/h8300.c (h8300_init_once): Likewise.
	* config/mips/mips.c (override_options): Likewise.
	* config/i386/i386.c (override_options): Likewise, rework.
	* config/m68k/m68k.c (override_options): Likewise.
	* cp/decl.c (init_decl_processing): Likewise.
	* java/jcf-parse.c (load_class): Likewise.

	* config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage
	instead of fatal.
	* config/mips/mips.c (print_operand): Likewise.

	* java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV.
	* objc/objc_act.c (objc_check_decl): Remove unneeded fatal call.
	(get_object_reference): Likewise.

From-SVN: r39443
2001-02-04 17:44:12 -05:00
Alexandre Petit-Bianco
493d561d62 class.c (layout_class): Don't lay the superclass out if it's already being laid out.
2001-01-23  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* class.c (layout_class): Don't lay the superclass out if it's
	already being laid out.
	* jcf-parse.c (handle_innerclass_attribute): New function.
	(HANDLE_INNERCLASSES_ATTRIBUTE): Invoke
	handle_innerclasses_attribute.
	(jcf_parse): Don't load an innerclasses if it's already being
	laid out.
	* jcf-write.c (append_innerclass_attribute_entry): Static
	`anonymous_name' and its initialization deleted. `ocii' and `ini'
	to be zero for anonymous classes.

2001-01-23  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* class.c (set_constant_value): Set DECL_FIELD_FINAL_IUD if
	necessary.
	* jcf-parse.c (set_source_filename): Use
	MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC if necessary.

2001-01-23  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* expr.c (build_jni_stub): Set DECL_CONTEXT on `meth_var' so it
	gets a unique asm name.

2001-01-23  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* jcf-parse.c (HANDLE_END_METHODS): Nullify current_method.
	(HANDLE_START_FIELD): Invoke MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC
	if necessary.
	(HANDLE_SYNTHETIC_ATTRIBUTE): New macro.
	* jcf-reader.c (get_attribute): Handle `Synthetic' attribute.
	* parse.y (lookup_package_type_and_set_next): Deleted.
	(resolve_package): Removed unnecessary code.
	(find_applicable_accessible_methods_list): `finit$' can't be
 	inherited.
	* verify.c (pop_argument_types): Added missing prototype.

(http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01812.html)

From-SVN: r39230
2001-01-24 00:08:36 -08:00
Per Bothner
9c0c88ac0d verify.c (VERIFICATION_ERROR_WITH_INDEX): New macro.
* verify.c (VERIFICATION_ERROR_WITH_INDEX):  New macro.
	(verify_jvm_instructions):  Use it, for better error messages on loads.

From-SVN: r39171
2001-01-21 12:36:46 -08:00
Per Bothner
230cbd5f4f verify.c (merge_type_state): Stil may have to merge even if LABEL_VERIFIED (label).
* verify.c (merge_type_state):  Stil may have to merge even if
	LABEL_VERIFIED (label).

From-SVN: r39170
2001-01-21 12:26:37 -08:00
Per Bothner
984ad2c633 Various patches to emit better messages on verification errors.
From-SVN: r39019
2001-01-14 13:48:10 -08:00
Kaveh R. Ghazi
80393943c7 Warning fixes:
* gjavah.c (NEED_PEEK_ATTRIBUTE, NEED_SKIP_ATTRIBUTE): Define

	* jcf-reader.c (peek_attribute, skip_attribute): Only define
	when requested.

	* parse.h (yyerror): If JC1_LITE, mark with ATTRIBUTE_NORETURN.

	* verify.c (CHECK_PC_IN_RANGE): Cast result of stmt-expr to void.

From-SVN: r36994
2000-10-21 15:10:38 +00:00
Tom Tromey
86e4b1e4fa expr.c (pop_type_0): Return `Object' if trying to merge two interface types.
* expr.c (pop_type_0): Return `Object' if trying to merge two
	interface types.
	* verify.c (merge_types): Don't return `TYPE_UNKNOWN' for
	interface types; `Object' is always a valid supertype.

From-SVN: r36378
2000-09-12 22:31:00 +00:00
Alexandre Petit-Bianco
3e99f50c2b verify.c (merge_types): Load the types to merge if necessary.
2000-09-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* verify.c (merge_types): Load the types to merge if necessary.

(http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00245.html)

From-SVN: r36243
2000-09-07 11:24:41 -07:00
Alexandre Petit-Bianco
81baa09a56 jcf-write.c (generate_bytecode_conditional): Re-installed lost Jan 6 2000 patch.
2000-08-14  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * jcf-write.c (generate_bytecode_conditional): Re-installed lost
        Jan 6 2000 patch.
        (generate_bytecode_insns): Check `nargs' before emitting it.
        * verify.c (merge_type_state): Fixed typo.
        * ChangeLog: Fixed typo in some jcf-write.c entries mentioning
        generate_bytecode_{conditional,insns}.

(http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00617.html)

From-SVN: r35733
2000-08-15 17:05:29 -07:00
Alexandre Petit-Bianco
c2952b018a Added Java 1.1 language features.
From-SVN: r32517
2000-03-13 21:01:05 -08:00
Kaveh R. Ghazi
df32d2ce42 buffer.h: PROTO -> PARAMS.
* buffer.h: PROTO -> PARAMS.
        * check-init.c: Likewise.
        * class.c: Likewise.
        * constants.c: Likewise.
        * convert.h: Likewise.
        * decl.c: Likewise.
        * except.c: Likewise.
        * expr.c: Likewise.
        * gjavah.c: Likewise.
        * java-except.h: Likewise.
        * java-tree.h: Likewise.
        * jcf-depend.c: Likewise.
        * jcf-dump.c: Likewise.
        * jcf-parse.c: Likewise.
        * jcf-path.c: Likewise.
        * jcf-reader.c: Likewise.
        * jcf-write.c: Likewise.
        * jcf.h: Likewise.
        * jv-scan.c: Likewise.
        * jvgenmain.c: Likewise.
        * jvspec.c: Likewise.
        * lang.c: Likewise.
        * lex.c: Likewise.
        * lex.h: Likewise.
        * parse-scan.y: Likewise.
        * parse.h: Likewise.
        * parse.y: Likewise.
        * typeck.c: Likewise.
        * verify.c: Likewise.
        * xref.c: Likewise.
        * xref.h: Likewise.
        * zextract.c: Likewise.
        * zipfile.h: Likewise.

From-SVN: r31550
2000-01-21 20:57:00 +00:00
Alexandre Petit-Bianco
de1f429d34 [multiple changes]
Tue Nov 30 12:36:15 1999  Anthony Green  <green@cygnus.com>

        * verify.c (verify_jvm_instructions): Create new return label
        chain if non existant (don't rely on the verified state of the jsr
        target.)

Tue Nov 23 17:29:40 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * verify.c (merge_type_state): Non verified subroutines being
        considered more than once to trigger passive type merge.

From-SVN: r30811
1999-12-06 11:56:58 -08:00
Kaveh R. Ghazi
1ebadc609b jcf-dump.c (print_constant, [...]): Don't call a variadic function with a non-literal format string.
* jcf-dump.c (print_constant, disassemble_method): Don't call a
	variadic function with a non-literal format string.

	* parse-scan.y (report_main_declaration): Likewise.

	* parse.h (ERROR_CAST_NEEDED_TO_INTEGRAL): Likewise.

	* parse.y (read_import_dir, patch_assignment, patch_binop,
	patch_array_ref): Likewise.

	* typeck.c (build_java_array_type): Likewise.

	* verify.c (verify_jvm_instructions): Likewise.

From-SVN: r29981
1999-10-14 17:13:57 +00:00
Kaveh R. Ghazi
d593dd8c6a class.c (finish_class): Remove unused parameter, all callers changed.
* class.c (finish_class): Remove unused parameter, all callers
	changed.

	* expr.c (build_java_athrow): Change return type to void.
	(java_lang_expand_expr): Make sure each case in switch returns a
	value.

	* java-tree.h (finish_class): Fix prototype to take void args.

	* jcf-dump.c (usage): Mark with ATTRIBUTE_NORETURN.
	(main): Issue return from main, not exit.

	* jcf-parse.c (parse_class_file): Fix call to `finish_class'.

	* jcf.h (jcf_unexpected_eof): Mark with ATTRIBUTE_NORETURN.

	* jv-scan.c (main): Issue return from main, not exit.

	* parse.y (check_abstract_method_definitions,
	java_check_abstract_method_definitions): Add static prototypes.
	(java_complete_expand_methods): Fix call to `finish_class'.

	* verify.c (verify_jvm_instructions): Initialize variables `oldpc'
	and `prevpc'.

From-SVN: r29065
1999-09-02 21:57:09 +00:00
Jeffrey A Law
5f9ee6953e gjavah.c, [...]: Do not use C++ style comments in C code.
* gjavah.c, jcf-write.c, verify.c: Do not use C++ style
        comments in C code.

From-SVN: r28940
1999-08-27 23:33:02 -06:00
Gregg Townsend
ee5cd6389e verify.c (verify_jvm_instructions): Don't check instruction validity beyond end of method.
Wed Aug 25 15:37:15 1999  Gregg Townsend  <gmt@cs.arizona.edu>

        * verify.c (verify_jvm_instructions): Don't check instruction
        validity beyond end of method.

From-SVN: r28897
1999-08-26 10:00:57 -07:00
Kaveh R. Ghazi
be245ac0a0 gjavah.c (print_name, [...]): Add static prototype.
* gjavah.c (print_name, print_base_classname, utf8_cmp,
	cxx_keyword_subst, generate_access, name_is_method_p,
	get_field_name, print_field_name, super_class_name, print_include,
	decode_signature_piece, print_class_decls, usage, help,
	java_no_argument, version, add_namelet, print_namelet): Add static
	prototype.
	(print_base_classname, utf8_cmp, cxx_keyword_subst,
	name_is_method_p): Constify a char*.
	(get_field_name): Likewise.  Prefer xstrdup over malloc/strcpy.
	Provide a final else clause in an if-else-if.
	(print_field_info): Add missing final arg in function call to
	`print_field_name'.
	(print_method_info, decompile_method, decode_signature_piece,
	print_c_decl, print_full_cxx_name, print_stub,
	print_mangled_classname, super_class_name, print_include,
	add_namelet, add_class_decl, print_class_decls, process_file,
	help): Constify a char*.

	* jcf-write.c (jcf_handler, push_constant1, push_constant2,
	push_int_const, find_constant_wide, find_constant_index,
	push_long_const, field_op, maybe_wide, emit_dup, emit_pop,
	emit_iinc, emit_load_or_store, emit_load, emit_store, emit_unop,
	emit_binop, emit_reloc, emit_switch_reloc, emit_case_reloc,
	emit_if, emit_goto, emit_jsr, call_cleanups,
	make_class_file_name): Add static prototypes.
	(generate_bytecode_return, generate_bytecode_insns): Pass a
	NULL_PTR, not a NULL_TREE.

	* jv-scan.c: Include "jcf.h".
	(main): Declare using DEFUN macro.

	* jvspec.c (find_spec_file, lang_specific_pre_link,
	lang_specific_driver): Add prototypes.
	(find_spec_file): Constify a char*.

	* keyword.gperf (hash, java_keyword): Add prototypes.

	* lang.c (lang_print_error): Add static prototype.
	(lang_init): Prefer memcpy over bcopy to avoid casts.

	* lex.c (yylex): Add static prototype.

	* parse-scan.y: Include "lex.c" earlier.

	* parse.h: Remove redundant declaration for `yylex'.

	* parse.y (java_decl_equiv, binop_compound_p, search_loop,
	labeled_block_contains_loop_p): Add static prototypes.
	(not_accessible_p): Make static to match prototype.

	* verify.c (start_pc_cmp): Don't needlessly cast away const.

From-SVN: r28862
1999-08-25 13:59:28 +00:00
Kaveh R. Ghazi
c8e7d2e632 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
1999-08-10 16:58:13 +00:00
Kaveh R. Ghazi
cd531a2edd Warning fixes:
* expr.c (build_java_soft_divmod): Provide a default case in switch.
        (java_lang_expand_expr): Mark parameters `target', `tmode' and
        `modifier' with ATTRIBUTE_UNUSED.

        * gjavah.c (process_file): Add braces around ambiguous `else'.

        * jcf-dump.c (print_access_flags, localvar_free): Change return
        type to void.

        * parse.y (java_complete_expand_method): Initialize variable
        `exception_copy'.
        (resolve_qualified_expression_name): Likewise for `field_decl'.
        (patch_method_invocation): Likewise for `class_to_search'.
        (qualify_ambiguous_name): Likewise for `name' and `ptr_type'.
        (patch_assignment): Likewise for `lhs_type'.

        * verify.c (verify_jvm_instructions): Remove unused variable
        `caller'.

From-SVN: r28344
1999-07-30 18:31:34 +00:00
Andrew Haley
45b0aa3189 verify.c (verify_jvm_instructions): Check for pending blocks before invalid PC test and opcode switch, not after.
1999-06-22  Andrew Haley  <aph@cygnus.com>
	* verify.c (verify_jvm_instructions): Check for pending blocks
	before invalid PC test and opcode switch, not after.

From-SVN: r27710
1999-06-22 23:22:13 +00:00
Andrew Haley
44d7502b78 except.c (find_handler_in_range): The upper limit for exception ranges is exclusive, not inclusive...
1999-06-21  Andrew Haley  <aph@cygnus.com>
        * except.c (find_handler_in_range): The upper limit for exception
        ranges is exclusive, not inclusive: (start <= pc < end).
        (link_handler): find child pointer which points to outer by
        searching sibling list: previous code incorrectly assumed that
        outer->outer->first_child must point to outer.
        * verify.c (verify_jvm_instructions): FIXME added to code for
        `athrow'.
        (verify_jvm_instructions): Do not assume that the last block
        processed in a subroutine is a block which ends with a `ret'
        instruction.  With some control flows it is possible that the last
        block ends with an `athrow'.

From-SVN: r27658
1999-06-21 09:18:50 +00:00
Kaveh R. Ghazi
ab3a6dd6e2 Warning fixes:
* class.c (build_utf8_ref): Initialize variable `field'.
        * decl.c (init_decl_processing): Initialize variable `field'.
        * expr.c (build_known_method_ref): Mark parameters `method_type',
        `method_signature' and `arg_list' with ATTRIBUTE_UNUSED.
        (process_jvm_instruction): Likewise for parameter `length'.
        * jvspec.c (lang_specific_driver): Mark variables `saw_math',
        `saw_libc', `saw_gc', `saw_threadlib' and `saw_libgcj' with
        ATTRIBUTE_UNUSED.
        * parse.y (maybe_generate_clinit): Remove unused variable
        `has_non_primitive_fields'.
        (find_in_imports_on_demand): Initialize variables `node_to_use'
        and `cl'.
        (patch_binop): Likewise for variable `prom_type'.
        (patch_unaryop): Likewise for variable `prom_type'.
        * verify.c (verify_jvm_instructions): Likewise for variable `last'.
        * xref.c (xref_table): Add missing initializer.

From-SVN: r27030
1999-05-19 11:30:30 +00:00
Tom Tromey
5a9e5c6fb6 java-except.h (struct eh_range): Removed unused `next' member.
* java-except.h (struct eh_range): Removed unused `next' member.
	* verify.c (verify_jvm_instructions): Call check_nested_ranges
	after adding all exception handlers.  Sort exception ranges in
	order of start PC.
	(struct pc_index): New structure.
	(start_pc_cmp): New function.
	* except.c (add_handler): Return `void'.  Don't call link_handler;
	instead construct an ordinary linked list and do range
	coalescing.
	(check_nested_ranges): New function.
	(link_handler): Changed interface to allow merging of eh_ranges.
	Split overlapping ranges.  Return `void'.

From-SVN: r26995
1999-05-18 15:03:26 +00:00
Per Bothner
fe34cca7a5 Fix thinko.
From-SVN: r26799
1999-05-05 17:33:11 -07:00
Per Bothner
10b905f1ea verify.c (verify_jvm_instructions): Better error messages.
�
	* verify.c (verify_jvm_instructions):  Better error messages.

From-SVN: r26788
1999-05-05 14:09:08 -07:00
Per Bothner
ab45646c4e expr.c (pop_type_0): New function.
�
	* expr.c (pop_type_0):  New function.
	(pop_type):  Use pop_type_0.
	* java-tree.h (pop_type_0):  New declaration.
	* verify.c (verify_jvm_instructions):  Check return instructions.

From-SVN: r26218
1999-04-06 07:28:39 -07:00
Kaveh R. Ghazi
152f94fc94 Warning fixes:
* class.c (maybe_add_interface): Remove unused variable
        `interface_binfo'.
        (make_class_data): Use = for assignment, not ==.  Likewise.
        (emit_register_classes): Remove unused variable `decl'.
        * lex.c: Fix comment so as not to contain an embedded `/*'.
        * verify.c (verify_jvm_instructions): Remove unused variable
        `self_type'.

From-SVN: r26046
1999-03-28 19:22:10 +00:00
Kaveh R. Ghazi
4bcde32e86 Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H).
* 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.

From-SVN: r25878
1999-03-21 06:09:25 +00:00
Kaveh R. Ghazi
7e21fe59b2 Warning fixes:
* constants.c (find_class_or_string_constant): Cast variable `j'
        to a `jword' when comparing against one.
        * expr.c (java_lang_expand_expr): Remove unused variables
        `has_finally_p' and `op0'.
        * gjavah.c (print_field_info): Cast a value to jint when comparing
        against one.  Likewise for a jlong.
        (add_namelet): Likewise cast a `sizeof' to an int when comparing
        against a signed quantity.
        * jcf-dump.c (print_signature_type): Remove unused variable `digit'.
        (print_signature): Don't needlessly dereference variable `str'
        * jcf-reader.c (get_attribute): Mark variables `max_stack' and
        `max_locals' with ATTRIBUTE_UNUSED.
        (jcf_parse_class): Likewise for variable `index'.
        * parse.h (reverse_jdep_list): Remove static prototype.
        * parse.y (build_jump_to_finally): Remove prototype and definition.
        (reverse_jdep_list): Add static prototype.
        * typeck.c (convert_ieee_real_to_integer): Remove unused variables
        `assignment' and `expr_decl'.
        * verify.c (verify_jvm_instructions): Remove unused label `bad_ldc'.

From-SVN: r25731
1999-03-12 17:13:24 +00:00
Per Bothner
66b4814089 Optimize: return (a ? b : c)' as: if (a) return b; else return c;'.
Optimize: `return (a ? b : c)' as: `if (a) return b; else return c;'.
	* jcf-write.c (generate_bytecode_return):  New function.
	(generate_bytecode_insns):  Use it, for RETURN_EXPR.
	* jcf-write.c (generate_bytecode_insns):  For REAL_CST that is 0 or 1,
	generate special [fd]const_[01] instructions.
	* jcf-parse.c (yyparse):  Don't emit_register_classes if -fsyntax-only.
	* verify.c (verify_jvm_instructions):  Do INVALIDATE_PC after
	handling OPCODE_lookupswitch or OPCODE_tableswitch.

From-SVN: r24972
1999-02-02 04:20:39 -08:00
Kaveh Ghazi
9b318a74d7 Update copyrights for the last patch
From-SVN: r24837
1999-01-23 21:49:56 +00:00
Kaveh R. Ghazi
d4476be259 Warning fixes:
* Makefile.in (parse.o): Depend on $(CONFIG_H) and
        $(srcdir)/../system.h.
        (class.o): Depend on $(PARSE_H) and $(srcdir)/../output.h.
        (jcf-parse.o): Depend on $(srcdir)/../toplev.h.
        (jcf-write.o): Likewise.
        (jv-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
        (mangle.o): Depend on $(srcdir)/../toplev.h.
        (parse-scan.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
        (zextract.o): Depend on $(CONFIG_H) and $(srcdir)/../system.h.
        * class.c: Include output.h and parse.h.
        (mangled_classname): Add the `const' keyword to a char*.
        (find_named_method): Hide unused function definition.
        (build_utf8_ref): Change type of variable `c' to unsigned char.
        Use ISALPHA/ISDIGIT instead of isalpha/isdigit.
        (build_class_ref): Add the `const' keyword to a char*.
        (layout_class_method): Remove unused variable `buf'.
        * decl.c (find_local_variable): Remove unused variable `rtl'.
        (pushdecl): Likewise for variables `different_binding_level' and
        `oldglobal'.
        (pushlevel): Mark parameter `unused' with ATTRIBUTE_UNUSED.
        (maybe_build_cleanup): Likewise for parameter `decl'.
        * except.c (expand_start_java_handler): Mark parameter `range'
        with ATTRIBUTE_UNUSED.
        * expr.c: Include except.h.
        (pop_type): Remove unused variable `i'.
        (pop_value): Likewise for variables `n_words' and `i'.
        (expand_java_arrayload): Likewise for variable `convert'.
        (java_lang_expand_expr): Likewise for variables `op0', `type',
        `mode', `unsignedp', `node' and `elements'.
        (expand_byte_code): Likewise for variables `prev_eh_ranges' and
        `eh_ranges'.
        (process_jvm_instruction): Add a `const' qualifier to a char*.
        * gjavah.c (output_directory): Add the `const' keyword to a char*.
        (temp_directory): Likewise.
        (print_c_decl): Likewise.
        (print_method_info): Likewise.
        (decode_signature_piece): Likewise.
        (print_mangled_classname): Likewise.
        * java-except.h: Provide prototypes for maybe_start_try,
        maybe_end_try and add_handler.
        * java-tree.h (mangled_classname): Add the `const' keyword to a char*.
        (parse_error_context): Likewise.  Also add ATTRIBUTE_PRINTF_2.
        (pushdecl_top_level, alloc_class_constant, unicode_mangling_length,
        init_expr_processing, push_super_field, init_class_processing,
        can_widen_reference_to, class_depth, verify_jvm_instructions,
        maybe_pushlevels, maybe_poplevels, process_jvm_instruction,
        set_local_type, merge_type_state, push_type, load_type_state,
        add_interface, find_in_current_zip, append_gpp_mangled_classtype,
        emit_unicode_mangled_name): Add prototypes.
        * jcf-dump.c (print_constant): Add the `const' keyword to a char*.
        (print_signature_type): Use ISDIGIT, not isdigit.
        (print_signature): Remove unused variable `j'.
        * jcf-io.c (jcf_filbuf_from_stdio): Cast the result of `fread' to
        int when comparing against one.
        * jcf-parse.c: Include toplev.h.
        * jcf-write.c: Likewise.  Don't include <string.h> or <sys/stat.h>.
        (localvar_free): Remove unused variable `i'.
        (generate_bytecode_conditional): Likewise for variable `kind'.
        * jv-scan.c: Include config.h and system.h.  Remove redundant
        OS header and gansidecl.h includes.
        (warning): Add the `const' keyword to a char*.  Also add
        ATTRIBUTE_PRINTF_1 to the prototype.  Check ANSI_PROTOTYPES, not
        __STDC__, when determining whether to use ANSI-isms.
        (fatal): Likewise.  Also add ATTRIBUTE_UNUSED.
        (xmalloc): Don't redundantly prototype here.
        (main): Remove unused parameter `envp'.  Also fix the arguments
        passed to function `fatal' to match the format specifier.
        * lang.c (java_tree_code_name): Add the `const' keyword to a char*.
        * mangle.c: Include toplev.h.
        (emit_unicode_mangled_name): Declare parameter `len'.
        * parse.y (parse_warning_context): Add the `const' keyword to a
        char*.  Also add ATTRIBUTE_PRINTF_2 to the prototype.  Check
        `ANSI_PROTOTYPES' not `__STDC__' for whether to use ANSI-isms.
        (issue_warning_error_from_context): Add the `const' keyword to
        a char*.
        (parse_error_context): Likewise.  Also check `ANSI_PROTOTYPES'
        not `__STDC__' for whether to use ANSI-isms.
        * typeck.c (incomplete_type_error): Mark parameters `value' and
        `type' with ATTRIBUTE_UNUSED.
        (parse_signature_type): Use ISDIGIT, not isdigit.
        * verify.c (check_pending_block): Add the `const' keyword to a char*.
        (verify_jvm_instructions): Likewise.  Remove unused variables
        `field_name' and `default_val'.
        * zextract.c: Include config.h and system.h.  Remove redundant
        OS header includes.
        * zipfile.h: Prototype `read_zip_archive'.

From-SVN: r24835
1999-01-23 20:47:03 +00:00
Per Bothner
2dc219a11d expr.c (process_jvm_instruction): Coerce to correct Throwable sub-type the result of the call that gets the...
�
	* expr.c (process_jvm_instruction):  Coerce to correct Throwable
	sub-type the result of the call that gets the exception value.
	* parse.y (java_complete_expand_methods):  If flags_syntax_only,
	don't call finish_class.
	* parse.y (java_check_regular_methods):  If METHOD_PRIVATE,
	clear found before continuing.
	* verify.c (verify_jvm_instructions):  On an array load, allow
	and handle top of stack to be TYPE_NULL.

From-SVN: r24696
1999-01-16 02:00:27 -08:00
Per Bothner
5a005d9ead expr.c (process_jvm_instruction): Do load_type_state after JSR.
d
	* expr.c (process_jvm_instruction):  Do load_type_state after JSR.
	* verify.c (verify_jvm_instructions):  Fix off-by-one error.
	* jcf-write.c (CHECK_PUT):  Add (void) cast to avoid -Wall warnings.
	(localvar_alloc):  Change return type to void,
	(emit_unop):  Remove unused variable size.
	* jcf-write.c (struct jcf_block):  Add new union.
	(PENDING_CLEANUP_PC, PENDING_EXIT_PC, UNDEFINED_PC):  New macros.
	(call_cleanups):  New functions.
	(struct jcf_partial):  New fields num_finalizers and return_value_decl.
	(generate_bytecode_insns):  Support CLEANUP_POINT_EXPR and
	WITH_CLEANUP_EXPR.  Handle cleanups in RETURN_EXPR and EXIT_BLOCK_EXPR.
	* lang.c (lang_init):  Call using_eh_for_cleanups.
	* parse.y (java_complete_lhs):  For SYNCHRONIZED_EXPR, defer
	completing operands to patch_synchronized_statement.
	Support CLEANUP_POINT_EXPR, WITH_CLEANUP_EXPR.
	(patch_synchronized_statement): Re-write suing CLEANUP_POINT_EXPR and
	WITH_CLEANUP_EXPR instead of TRY_EXPR.

From-SVN: r24406
1998-12-23 02:46:45 -08:00
Per Bothner
46cf461c83 Allow uses of interface types to verify.
�
	Allow uses of interface types to verify.  This is not really
	type-safe, but it matches what Sun does, and is OK as long as
	there are appropriate run-time checks.
	* verify.c (merge_types):  If merging two interface types,
	just set the result to java.lang.Object.
	* expr.c (pop_type):  Any interface is matches by java.lang.Object.

From-SVN: r23656
1998-11-14 09:22:22 -08:00
Per Bothner
e4de5a1022
Merge from Cygnus internal source tree.

From-SVN: r23025
1998-10-12 05:43:53 -07:00
Jeffrey A Law
1f43f4b493 Makefile.in: Add many missing dependencies.
* Makefile.in: Add many missing dependencies.
        * buffer.c, class.c, constants.c, decl.c: Use system.h and toplev.h
        as appropriate.
        * except.c, expr.c, jcf-io.c jcf-parse.c, jcf-write.c: Likewise.
        * jvgenmain.c lang.c mangle.c typeck.c verify.c: Likewise.

From-SVN: r22410
1998-09-14 03:42:24 -06:00
Anthony Green
e04a16fbee Initial revision
From-SVN: r22299
1998-09-06 15:36:06 +00:00