Commit Graph

7 Commits

Author SHA1 Message Date
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 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
Alexandre Petit-Bianco
5e942c5066 class.c (is_compiled_class): Call safe_layout_class for class compiled from source.
Tue Nov 10 12:34:03 1998  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* class.c (is_compiled_class): Call safe_layout_class for class
 	compiled from source.
	* conver.h (convert_to_integer, convert_to_real,
 	convert_to_pointer): Added prototypes.
	* decl.c (init_decl_processing): Non longer push the decls of
 	`methodtable', `constants', `Class', `Field', `dispatchTable'
 	`jexception' and `Method'.
	* expr.c (build_invokeinterface): New function.
	(expand_invoke): static variable CLASS_IDENT now in
 	build_invokeinterface. Use build_invokeinterface.
	(expand_java_field_op): Moved code to inline
 	java.lang.PRIMTYPE.TYPE into a function.
	(build_primtype_type_ref): New function.
	* java-tree.def (INSTANCEOF_EXPR): New tree code.
	* java-tree.h (CLASS_METHOD_CHECKED_P, METHOD_DEPRECATED,
 	FIELD_DEPRECATED, CLASS_DEPRECATED): New flag macros.
	(DECL_CONSTRUCTOR_P): Fixed typo in comment.
	(DECL_LOCAL_STATIC_VALUE): New macro.
	(build_invokeinterface, build_primtype_type_ref): New function
 	prototypes.
	(java_parse_abort_on_error): Macro rewritten.
	* jcf-parse.c (current_method): Add comment to declaration.
	(parse_zip_file_entries, process_zip_dir, void parse_source_file):
 	Function prototypes fixed.
	(jcf_parse_source): push/pop parser context. save/restore global.
	(parse_source_file): Fixed leading comment. Now take a
 	IDENTIFIER_NODE as an argument. Doesn't check methods, layout
 	classes and pop the parser context anymore.
	(yyparse): Push parser context, save globals, parse the source
 	file, restore globals and pop the parser context when processing a
 	source file.
	* jcf.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG define.
	* lex.c (java_parse_doc_section): New function.
	(java_lex): Call java_parse_doc_section when appropriate. Build an
 	operator around INSTANCEOF_TK.
	* lex.h (java_lineterminator, java_sprint_unicode,
 	java_unicode_2_utf8, java_lex_error, java_store_unicode):
 	Prototypes rewritten.
	(java_parse_escape_sequence, java_letter_or_digit_p,
 	java_parse_doc_section, java_parse_end_comment, java_get_unicode,
 	java_read_unicode, java_store_unicode, java_read_char,
 	java_allocate_new_line, java_unget_unicode, java_sneak_unicode):
 	Added function prototypes.
	* parse.h (VERBOSE_SKELETON): Replaces SOURCE_FRONTEND_DEBUG
 	define.
	(JNULLP_TYPE_P, CHECK_METHODS, CHECK_DEPRECATED, REGISTER_IMPORT):
 	New macros
	(struct parser_ctxt): New fields: deprecated,
 	current_parsed_class_un, gclass_list.
	(fix_method_argument_names, issue_warning_error_from_context,
 	resolve_package, lookup_package_type): New function prototypes.
	(resolve_expression_name): Fixed function prototype.
	(find_applicable_accessible_methods_list): Fixed indentation, added
	extra argument in prototype.
	(check_final_assignment, build_null_of_type, check_deprecation,
 	check_method_redefinition, reset_method_name,
 	java_check_regular_methods, java_check_abstract_methods,
 	maybe_build_primttype_type_ref): New function prototype.
	* parse.y (conver.h): Include.
	(INSTANCEOF_TK): Tagged <operator>.
	(single_type_import_declaration): Use REGISTER_IMPORT macro.
	(relational_expression:): Build binop for instanceof.
	(java_push_parser_context): Remember ctxp->gclass_list across
 	contexts.
	(java_pop_parser_context): Simply return if no context
 	exists. Remember gclass_list across contexts.
	(issue_warning_error_from_context): New function.
	(parse_error_context): Don't setup ctxp->elc here. Call
 	issue_warning_error_from_context instead.
	(parse_warning_context): Likewise.
	(maybe_create_class_interface_decl): Removed DECL_ARTIFICIAL
 	setup. Link new class/interface to ctxp->gclass_list.
	(add_superinterfaces): Register interface as incomplete if not
 	loaded.
	(create_class): Remember class unqualified name in
 	ctxp->current_parsed_class_un. Check class deprecation.
	(register_fields): Check field deprecation. Remember static final
 	field value in DECL_LOCAL_STATIC_VALUE. Changed comment in part
 	processing INIT.
	(method_header): New local variable ORIG_ARG. Use unqualified
 	current class name for check on constructor errors. Promote return
 	type if of record type. Argument list fix moved in
 	fix_method_argument_names, called here. Check method deprecation.
	(fix_method_argument_names): New function.
	(method_declarator): Promote record typed arguments.
	(safe_layout_class): Check class methods before layout.
	(java_complete_class): Compute field layout when patched.
	(do_resolve_class): Try to load class after having it renamed
 	after the package name.
	(get_printable_method_name): Use DECL_CONTEXT.
	(reset_method_name): New function.
	(check_method_redefinition): Use reset_method_name.
	(java_check_regular_methods): New local variable
 	SAVED_FOUND_WFL. Temporarily reinstall overriding/hiding method
 	names for error report. Check for compile-time error when method
 	found has default (package) access.
	(java_check_abstract_methods): Now takes an interface DECL node as
 	an argument. Also reinstall real name on unchecked
 	overriding/hiding methods for error report.
	(java_check_methods): Fixed leading comment. Get classes to verify
 	from ctxp->gclass_list. Use CHECK_METHODS macro and set
 	CLASS_METHOD_CHECKED_P on class verification.
	(lookup_java_method2): Get real method name if necessary.
	(find_in_imports): Don't check package class access here.
	(resolve_package, lookup_package_type): New functions.
	(java_layout_classes): Fixed leading comment. Take classes to be
 	laid out from ctxp->gclass_list.
	(java_complete_expand_methods): Don't expand native and abstract
 	methods.
	(java_expand_classes): New function.
	(resolve_expression_name): Use additional argument ORIG.  Retrieve
 	values of static final field of primitive types.
	(resolve_field_access): Handles static final field of promotive
 	type.
	(resolve_qualified_expression_name): Handle STRING_CST as
 	primaries and package name resolution. Check deprecation on found
 	decls. Set where_found and type_found on non static field resolved
 	during qualification. Layout non primitive field decl types.
	(check_deprecation): New function.
	(maybe_access_field): Simplified.
	(patch_method_invocation_stmt): Local variable CLASS_TYPE
 	removed. Reverse method's argument when primary is a type. Don't
 	use CLASS_TYPE to report problems, use IDENTIFIER_WFL
 	instead. Include abstract class in the list of class searchable
 	for constructors. Use DECL_CONTEXT of found method for access
 	checks. Check method deprecation.
	(patch_invoke): Pay extra care to NEW_CLASS_EXPR type call when
 	converting arguments. Handle INVOKE_INTERFACE.
	(lookup_method_invoke): Search constructor using existing
 	infrastructure (don't rely on lookup_java_constructor anymore).
	(find_applicable_accessible_methods_list): Extra argument flag
 	LC. Now include constructor in the search.
	(qualify_ambiguous_name): Conditional expression are primaries.
	(not_initialized_as_it_should_p): static final are always
 	initialized.
	(java_complete_tree): Pass extra NULL argument to
 	resolve_expression_name. Stricter test to carry on patching
 	assignments. New case for INSTANCEOF_EXPR.
	(complete_function_arguments): Inline PRIMTYPE.TYPE read access.
	(check_final_assignment, maybe_build_primttype_type_ref): New
 	functions.
	(patch_assignment): Detect resolved static finals and carry normal
 	assignment error check on them. Inline PRIMTYPE.TYPE read access.
	(try_builtin_assignconv): Access constant 0 on all primitive
 	types.
	(valid_builtin_assignconv_identity_widening_p): Accept identical
 	types. Accept all promoted type on int type.
	(valid_ref_assignconv_cast_p): Accept a null pointer to be
 	assigned to a reference.
	(valid_method_invocation_conversion_p): Accept to check null
 	pointers.
	(build_binop): Merge declaration and initialization of local
 	variable BINOP.
	(patch_binop): New case for INSTANCEOF_EXPR. NE_EXPR to accept all
 	numeric types. Improved validity test for qualify operators on
 	references.
	(patch_unaryop): Broadened rejection test for PREDECREMENT_EXPR
 	and PREINCREMENT_EXPR. Also detect resolved static finals of a
 	primitive type and issue the appropriate error message.
	(resolve_type_during_patch): Mark class loaded when resolved.
	(patch_cast): Allow null to be cased to reference types.
	(build_null_of_type): New function.
	(patch_array_ref): Handle array on references correctly.
	(patch_return): Removed unused local variable MODIFY. Force
 	boolean to be returned as integers. Allows null to be returned by
 	a function returning a reference.
	* typeck.c (convert_to_integer, convert_to_real,
 	convert_to_pointer): Prototypes moved to convert.h
	(lookup_argument_method): Use method real name, if necessary.
This improves method checking, gets rid of a cross file type
dependency bug and does a more robust job at laying out classes when
necessary. It unifies the regular methods and constructors lookup. It
implements the `instanceof' operator and interface method
invocations. It also fixes random bugs.

From-SVN: r23599
1998-11-10 10:04:25 -08:00
Jeffrey A Law
5ed948cea5 jcf-write.c (emit_load_or_store): Avoid implicit int arguments.
* jcf-write.c (emit_load_or_store): Avoid implicit int arguments.
        * mangle.c (emit_unicode_mangled_name): Similarly.

From-SVN: r23382
1998-10-27 16:48:07 -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