diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2001-02-04 22:44:12 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2001-02-04 17:44:12 -0500 |
commit | 400500c4a50104969a303ba3c41983b134523e15 (patch) | |
tree | 8141b8180c25362fac62609d1e35c61c9cc898f6 | |
parent | eab4abeb4d4463182fe24fe3ef8a7b40d1a1eec5 (diff) | |
download | gcc-400500c4a50104969a303ba3c41983b134523e15.zip gcc-400500c4a50104969a303ba3c41983b134523e15.tar.gz gcc-400500c4a50104969a303ba3c41983b134523e15.tar.bz2 |
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
50 files changed, 754 insertions, 564 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 721efd4..3a77f7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,63 @@ +Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * 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. + + * except.c (duplicate_eh_handlers): Call abort instead of fatal. + * flow.c (verify_flow_info): 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. + * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): + Deleted. + * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. + + * c-parse.in (methoddef): Call fatal_error instead of fatal. + * objc/objc-act.c (build_ivar_chain): Likewise. + * 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. + * objc/objc-act.c (objc_init): Likewise. + + * config/arm/arm.c (arm_override_options): Make errors non-fatal. + * 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. + + * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage + instead of fatal. + * config/mips/mips.c (print_operand): 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. + * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. + (get_object_reference): Likewise. + 2001-02-04 Nick Clifton <nickc@redhat.com> * config/arm/arm.c (all_cores): Add 710T, 720T, 740T, 940T, 9e, diff --git a/gcc/c-parse.in b/gcc/c-parse.in index a51161c..4f1de58 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -2501,7 +2501,7 @@ methoddef: if (objc_implementation_context) objc_inherit_code = CLASS_METHOD_DECL; else - fatal ("method definition not in class context"); + fatal_error ("method definition not in class context"); } methoddecl { @@ -2526,7 +2526,7 @@ methoddef: if (objc_implementation_context) objc_inherit_code = INSTANCE_METHOD_DECL; else - fatal ("method definition not in class context"); + fatal_error ("method definition not in class context"); } methoddecl { diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index f26c571..53dd0dd 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -573,7 +573,7 @@ arm_override_options () target_flags |= ARM_FLAG_APCS_FRAME; if (TARGET_APCS_REENT && flag_pic) - fatal ("-fpic and -mapcs-reent are incompatible"); + error ("-fpic and -mapcs-reent are incompatible"); if (TARGET_APCS_REENT) warning ("APCS reentrant code not supported. Ignored"); @@ -621,7 +621,7 @@ arm_override_options () else if (streq (target_fp_name, "3")) arm_fpu_arch = FP_SOFT3; else - fatal ("Invalid floating point emulation option: -mfpe-%s", + error ("Invalid floating point emulation option: -mfpe-%s", target_fp_name); } else @@ -9425,6 +9425,7 @@ is_called_in_ARM_mode (func) } /* The bits which aren't usefully expanded as rtl. */ + const char * thumb_unexpanded_epilogue () { @@ -9489,7 +9490,8 @@ thumb_unexpanded_epilogue () if (mask == 0) /* Oh dear! We have no low registers into which we can pop high registers! */ - fatal ("No low registers available for popping high registers"); + internal_error + ("no low registers available for popping high registers"); for (next_hi_reg = 8; next_hi_reg < 13; next_hi_reg++) if (regs_ever_live[next_hi_reg] && !call_used_regs[next_hi_reg] @@ -10066,7 +10068,7 @@ output_thumb_prologue (f) const char * thumb_load_double_from_address (operands) - rtx * operands; + rtx *operands; { rtx addr; rtx base; @@ -10075,13 +10077,10 @@ thumb_load_double_from_address (operands) rtx arg2; if (GET_CODE (operands[0]) != REG) - fatal ("thumb_load_double_from_address: destination is not a register"); + abort (); if (GET_CODE (operands[1]) != MEM) - { - debug_rtx (operands[1]); - fatal ("thumb_load_double_from_address: source is not a computed memory address"); - } + abort (); /* Get the memory address. */ addr = XEXP (operands[1], 0); @@ -10124,7 +10123,7 @@ thumb_load_double_from_address (operands) base = arg1, offset = arg2; if (GET_CODE (base) != REG) - fatal ("thumb_load_double_from_address: base is not a register"); + abort (); /* Catch the case of <address> = <reg> + <reg> */ if (GET_CODE (offset) == REG) @@ -10181,8 +10180,7 @@ thumb_load_double_from_address (operands) break; default: - debug_rtx (operands[1]); - fatal ("thumb_load_double_from_address: Unhandled address calculation"); + abort (); break; } diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 3dc1123..b01f951 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -182,18 +182,18 @@ avr_override_options () avr_mcu_name); for (t = avr_mcu_types; t->name; t++) fprintf (stderr," %s\n", t->name); - fatal ("select right MCU name"); } switch (t->arch) { - case AVR1: - default: - fatal ("MCU `%s' not supported", avr_mcu_name); - case AVR2: avr_enhanced_p = 0; avr_mega_p = 0; break; - case AVR3: avr_enhanced_p = 0; avr_mega_p = 1; break; - case AVR4: avr_enhanced_p = 1; avr_mega_p = 0; break; - case AVR5: avr_enhanced_p = 1; avr_mega_p = 1; break; + case AVR1: + default: + error ("MCU `%s' not supported", avr_mcu_name); + /* ... fall through ... */ + case AVR2: avr_enhanced_p = 0; avr_mega_p = 0; break; + case AVR3: avr_enhanced_p = 0; avr_mega_p = 1; break; + case AVR4: avr_enhanced_p = 1; avr_mega_p = 0; break; + case AVR5: avr_enhanced_p = 1; avr_mega_p = 1; break; } if (optimize && !TARGET_NO_TABLEJUMP) @@ -910,7 +910,7 @@ ptrreg_to_str (regno) case REG_Y: return "Y"; case REG_Z: return "Z"; default: - fatal ("register r%d isn't a pointer\n", regno); + abort (); } return NULL; } @@ -933,10 +933,6 @@ cond_string (code) return "pl"; else return "ge"; - case GT: - fatal ("Internal compiler bug: command `bgt'"); - case LE: - fatal ("Internal compiler bug: command `ble'"); case LT: if (cc_prev_status.flags & CC_OVERFLOW_UNUSABLE) return "mi"; @@ -944,10 +940,6 @@ cond_string (code) return "lt"; case GEU: return "sh"; - case GTU: - fatal ("Internal compiler bug: command `bgtu'"); - case LEU: - fatal ("Internal compiler bug: command `bleu'"); case LTU: return "lo"; default: @@ -4532,7 +4524,7 @@ unique_section (decl, reloc) prefix = ".text"; } else - fatal ("Strange situation: unique section is not a FUNCTION_DECL"); + abort (); if (flag_function_sections) { @@ -5009,7 +5001,7 @@ avr_normalize_condition (condition) case LEU: return LTU; default: - fatal ("Wrong condition: %s", GET_RTX_NAME (condition)); + abort (); } } diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 1f65ba6..48f4451 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -1,26 +1,26 @@ /* Subroutines for assembler code output on the TMS320C[34]x - Copyright (C) 1994, 1995, 1996, 1997, 1998, - 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) and Herman Ten Brugge (Haj.Ten.Brugge@net.HCC.nl). - This file is part of GNU CC. +This file is part of GNU CC. - GNU CC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. - GNU CC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with GNU CC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ /* Some output-actions in c4x.md need these. */ #include "config.h" @@ -858,8 +858,9 @@ c4x_expand_prologue () requires more than 32767 words of local temporary storage! */ if (size > 32767) - fatal ("ISR %s requires %d words of local vars, max is 32767.", + error ("ISR %s requires %d words of local vars, max is 32767.", current_function_name, size); + insn = emit_insn (gen_addqi3 (gen_rtx_REG (QImode, SP_REGNO), gen_rtx_REG (QImode, SP_REGNO), GEN_INT (size))); @@ -1408,7 +1409,7 @@ c4x_emit_libcall (libcall, code, dmode, smode, noperands, operands) break; default: - fatal ("c4x_emit_libcall: Bad number of operands"); + abort (); } insns = get_insns (); @@ -3970,7 +3971,7 @@ c4x_valid_operands (code, operands, mode, force) break; default: - fatal ("c4x_valid_operands: Internal error"); + abort (); break; } diff --git a/gcc/config/dsp16xx/dsp16xx.c b/gcc/config/dsp16xx/dsp16xx.c index 0c81dd1..c74ac38 100644 --- a/gcc/config/dsp16xx/dsp16xx.c +++ b/gcc/config/dsp16xx/dsp16xx.c @@ -1,5 +1,5 @@ /* Subroutines for assembler code output on the DSP1610. - Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc. Contributed by Michael Collison (collison@world.std.com). This file is part of GNU CC. @@ -268,8 +268,7 @@ dsp16xx_reg_class_from_letter (c) return SLOW_MEM_LOAD_REGS; default: - fatal ("Invalid register class letter %c", c); - return NO_REGS; + abort (); } } /* Return the class number of the smallest class containing @@ -371,7 +370,7 @@ limit_reload_class (mode, class) return class; case ACCUM_HIGH_REGS: - fatal ("ACCUM_HIGH_REGS class in limit_reload_class"); + abort (); case A1L_REG: case ACCUM_LOW_REGS: @@ -398,7 +397,7 @@ limit_reload_class (mode, class) return class; case YH_OR_ACCUM_HIGH_REGS: - fatal ("YH_OR_ACCUM_HIGH_REGS found in limit_reload_class"); + abort (); case X_OR_YH_REGS: return class; @@ -406,8 +405,7 @@ limit_reload_class (mode, class) case YL_REG: /* Register 'yl' is invalid for QImode, so we should never see it. */ - - fatal ("YL found in limit_reload_class"); + abort (); case YL_OR_ACCUM_LOW_REGS: case X_OR_YL_REGS: @@ -1220,26 +1218,24 @@ function_prologue (file, size) { if (current_frame_info.var_size == 1) fprintf (file, "\t*%s++\n", sp); + else if (SMALL_INTVAL (current_frame_info.var_size) + && ((current_frame_info.var_size & 0x8000) == 0)) + fprintf (file, "\t%s=%ld\n\t*%s++%s\n", reg_names[REG_J], + current_frame_info.var_size, sp, reg_names[REG_J]); else - { - if(SMALL_INTVAL(current_frame_info.var_size) && ((current_frame_info.var_size & 0x8000) == 0)) - fprintf (file, "\t%s=%ld\n\t*%s++%s\n", reg_names[REG_J], current_frame_info.var_size, sp, reg_names[REG_J]); - else - fatal ("Stack size > 32k"); - } + error ("Stack size > 32k"); } - /* Save any registers this function uses, unless they are - * used in a call, in which case we don't need to - */ + /* Save any registers this function uses, unless they are used in a call, + in which case we don't need to. */ - for( regno = 0; regno < FIRST_PSEUDO_REGISTER; ++ regno ) + for (regno = 0; regno < FIRST_PSEUDO_REGISTER; ++ regno) if (dsp16xx_call_saved_register (regno)) { #if OLD_REGISTER_SAVE - fprintf( file, "\t*%s++=%s\n", sp, reg_names[regno] ); + fprintf (file, "\t*%s++=%s\n", sp, reg_names[regno]); #else - fprintf( file, "\tpush(*%s)=%s\n", sp, reg_names[regno] ); + fprintf (file, "\tpush(*%s)=%s\n", sp, reg_names[regno]); #endif } @@ -1247,24 +1243,23 @@ function_prologue (file, size) { if (current_frame_info.args_size == 1) fprintf (file, "\t*%s++\n", sp); + else if (SMALL_INTVAL (current_frame_info.args_size) + && (current_frame_info.args_size & 0x8000) == 0) + fprintf (file, "\t%s=%ld\n\t*%s++%s\n", reg_names[REG_J], + current_frame_info.args_size, sp, reg_names[REG_J]); else - { - if(SMALL_INTVAL(current_frame_info.args_size) && ((current_frame_info.args_size & 0x8000) == 0)) - fprintf (file, "\t%s=%ld\n\t*%s++%s\n", reg_names[REG_J], current_frame_info.args_size, sp, reg_names[REG_J]); - else - fatal ("Stack size > 32k"); - } + error ("Stack size > 32k"); } if (frame_pointer_needed) { - fprintf( file, "\t%s=%s\n", a1h, sp ); - fprintf( file, "\t%s=%s\n", fp, a1h ); /* Establish new base frame */ - fprintf( file, "\t%s=%ld\n", reg_names[REG_J], -total_size); - fprintf( file, "\t*%s++%s\n", fp, reg_names[REG_J]); + fprintf (file, "\t%s=%s\n", a1h, sp); + fprintf (file, "\t%s=%s\n", fp, a1h); /* Establish new base frame */ + fprintf (file, "\t%s=%ld\n", reg_names[REG_J], -total_size); + fprintf (file, "\t*%s++%s\n", fp, reg_names[REG_J]); } - fprintf( file, "\t/* END FUNCTION PROLOGUE: */\n\n" ); + fprintf (file, "\t/* END FUNCTION PROLOGUE: */\n\n"); } void @@ -1482,9 +1477,10 @@ double_reg_to_memory (operands) else if (GET_CODE (XEXP(addr,1)) == CONST_INT) offset = INTVAL(XEXP(addr,1)) + 1; else - fatal ("Invalid addressing mode"); + abort (); - fprintf (asm_out_file, "\t*(%d)=%s\n", offset + 31, reg_names[REGNO(operands[1]) + 1]); + fprintf (asm_out_file, "\t*(%d)=%s\n", offset + 31, + reg_names[REGNO(operands[1]) + 1]); } else { @@ -1660,40 +1656,43 @@ print_operand(file, op, letter) { /* Print the low half of a 32-bit register pair */ if (letter == 'w') - fprintf( file, "%s", reg_names[REGNO(op)+1] ); + fprintf (file, "%s", reg_names[REGNO (op) + 1]); else if (letter == 'u' || !letter) - fprintf( file, "%s", reg_names[REGNO(op)]); + fprintf (file, "%s", reg_names[REGNO (op)]); else if (letter == 'b') - fprintf ( file, "%sh", reg_names[REGNO(op)]); + fprintf (file, "%sh", reg_names[REGNO (op)]); else if (letter == 'm') - fprintf (file, "%s", himode_reg_name[REGNO(op)]); + fprintf (file, "%s", himode_reg_name[REGNO (op)]); else - fatal("Bad register extension code"); + output_operand_lossgae ("Bad register extension code"); } - else if( code == MEM ) - output_address( XEXP(op,0) ); - else if( code == CONST_INT ) - { + else if (code == MEM) + output_address (XEXP(op,0)); + else if (code == CONST_INT) + { HOST_WIDE_INT val = INTVAL (op); - if( letter == 'H' ) - fprintf( file, HOST_WIDE_INT_PRINT_HEX, val & 0xffff); + + if (letter == 'H') + fprintf (file, HOST_WIDE_INT_PRINT_HEX, val & 0xffff); else if (letter == 'h') - fprintf( file, HOST_WIDE_INT_PRINT_DEC, val); - else if( letter == 'U' ) - fprintf( file, HOST_WIDE_INT_PRINT_HEX, (val >> 16) & 0xffff); + fprintf (file, HOST_WIDE_INT_PRINT_DEC, val); + else if (letter == 'U') + fprint(f file, HOST_WIDE_INT_PRINT_HEX, (val >> 16) & 0xffff); else - output_addr_const( file, op ); - } - else if( code == CONST_DOUBLE && GET_MODE(op) != DImode ) - { - union { double d; int i[2]; } u; - union { float f; int i; } u1; - u.i[0] = CONST_DOUBLE_LOW (op); - u.i[1] = CONST_DOUBLE_HIGH (op); - u1.f = u.d; - fprintf( file, "0x%x", u1.i ); - } - else output_addr_const( file, op); + output_addr_const (file, op); + } + else if (code == CONST_DOUBLE && GET_MODE (op) != DImode) + { + union {double d; int i[2]; } u; + union {float f; int i; } u1; + + u.i[0] = CONST_DOUBLE_LOW (op); + u.i[1] = CONST_DOUBLE_HIGH (op); + u1.f = u.d; + fprintf (file, "0x%x", u1.i); + } + else + output_addr_const (file, op); } @@ -1726,10 +1725,10 @@ print_operand_address(file, addr) if (offset >= -31 && offset <= 0) offset = 31 + offset; else - fatal ("Invalid offset in ybase addressing"); + abort (); } else - fatal ("Invalid register in ybase addressing"); + abort (); fprintf (file, "*(%d)", offset); break; @@ -1743,7 +1742,7 @@ print_operand_address(file, addr) } void -output_dsp16xx_float_const(operands) +output_dsp16xx_float_const (operands) rtx *operands; { rtx src = operands[1]; @@ -1758,7 +1757,7 @@ output_dsp16xx_float_const(operands) operands[1] = GEN_INT (value); output_asm_insn ("%u0=%U1\n\t%w0=%H1", operands); #else - fatal ("inline float constants not supported on this host"); + fatal_error ("inline float constants not supported on this host"); #endif } @@ -1902,7 +1901,7 @@ emit_1600_core_shift (shift_op, operands, shift_amount) shift_asm_ptr_first = lshift_right_asm_first; } else - fatal ("Invalid shift operator in emit_1600_core_shift"); + abort (); while (shift_amount != 0) { @@ -1984,19 +1983,21 @@ asm_output_float (file, fp_const) double fp_const; { #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT - REAL_VALUE_TYPE d = fp_const; - long value; + REAL_VALUE_TYPE d = fp_const; + long value; - REAL_VALUE_TO_TARGET_SINGLE (d, value); - fputs ("\tint ", file); + REAL_VALUE_TO_TARGET_SINGLE (d, value); + fputs ("\tint ", file); #ifdef WORDS_BIG_ENDIAN - fprintf (file, "0x%-4.4lx, 0x%-4.4lx", (value >> 16) & 0xffff, (value & 0xffff)); + fprintf (file, "0x%-4.4lx, 0x%-4.4lx", (value >> 16) & 0xffff, + value & 0xffff); #else - fprintf (file, "0x%-4.4lx, 0x%-4.4lx", (value & 0xffff), (value >> 16) & 0xffff); + fprintf (file, "0x%-4.4lx, 0x%-4.4lx", value & 0xffff, + (value >> 16) & 0xffff); #endif - fputs ("\n", file); + fputs ("\n", file); #else - fatal ("inline float constants not supported on this host"); + fatal_error ("inline float constants not supported on this host"); #endif } @@ -2171,17 +2172,15 @@ gen_tst_reg (x) mode = GET_MODE (x); if (mode == QImode) - { - emit_insn (gen_rtx_PARALLEL - (VOIDmode, - gen_rtvec (2, gen_rtx_SET (VOIDmode, cc0_rtx, x), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_SCRATCH (QImode))))); - } + emit_insn (gen_rtx_PARALLEL + (VOIDmode, + gen_rtvec (2, gen_rtx_SET (VOIDmode, cc0_rtx, x), + gen_rtx_CLOBBER (VOIDmode, + gen_rtx_SCRATCH (QImode))))); else if (mode == HImode) emit_insn (gen_rtx_SET (VOIDmode, cc0_rtx, x)); else - fatal ("Invalid mode for gen_tst_reg"); + abort (); return cc0_rtx; } @@ -2262,7 +2261,7 @@ gen_compare_reg (code, x, y) force_reg (HImode,y)))); } else - fatal ("Invalid mode for integer comparison in gen_compare_reg"); + abort (); return cc0_rtx; } @@ -2286,9 +2285,3 @@ output_block_move (operands) fprintf (asm_out_file, "\t}\n"); return ""; } - -void -dsp16xx_invalid_register_for_compare () -{ - fatal ("Invalid register for compare"); -} diff --git a/gcc/config/dsp16xx/dsp16xx.md b/gcc/config/dsp16xx/dsp16xx.md index 28cf9c7..ce7fb96 100644 --- a/gcc/config/dsp16xx/dsp16xx.md +++ b/gcc/config/dsp16xx/dsp16xx.md @@ -1,5 +1,5 @@ ;;- Machine description for the AT&T DSP1600 for GNU C compiler -;; Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc. ;; Contributed by Michael Collison (collison@world.std.com). ;; This file is part of GNU CC. @@ -175,17 +175,13 @@ { output_asm_insn (\"a0=%0\", operands); } - else if (IS_YBASE_REGISTER_WINDOW (REGNO(operands[0]))) - { - output_asm_insn (\"a0=%u0\;a0l=%w0\", operands); - } + else if (IS_YBASE_REGISTER_WINDOW (REGNO (operands[0]))) + output_asm_insn (\"a0=%u0\;a0l=%w0\", operands); else - dsp16xx_invalid_register_for_compare (); + abort (); } else if (GET_CODE(operands[0]) == CONST_INT) - { - output_asm_insn (\"a0=%U0\;a0l=%H0\", operands); - } + output_asm_insn (\"a0=%U0\;a0l=%H0\", operands); else if (GET_CODE (operands[0]) == MEM) { rtx xoperands[2]; @@ -197,17 +193,12 @@ if (GET_CODE(operands[1]) == REG) { - if (REGNO (operands[1]) == REG_Y - || REGNO (operands[1]) == REG_PROD) - { - output_asm_insn (\"a1=%1\", operands); - } - else if (IS_YBASE_REGISTER_WINDOW (REGNO(operands[1]))) - { - output_asm_insn (\"a1=%u1\;a1l=%w1\", operands); - } + if (REGNO (operands[1]) == REG_Y || REGNO (operands[1]) == REG_PROD) + output_asm_insn (\"a1=%1\", operands); + else if (IS_YBASE_REGISTER_WINDOW (REGNO (operands[1]))) + output_asm_insn (\"a1=%u1\;a1l=%w1\", operands); else - dsp16xx_invalid_register_for_compare (); + abort (); } else if (GET_CODE (operands[1]) == MEM) { diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index c2ebcf6..a52120c 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1,5 +1,5 @@ /* Subroutines for insn-output.c for Hitachi H8/300. - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Steve Chamberlain (sac@cygnus.com), Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com). @@ -113,7 +113,10 @@ h8300_init_once () h8_mov_op = h8_mov_ops[cpu_type]; if (!TARGET_H8300S && TARGET_MAC) - fatal ("-ms2600 is used without -ms."); + { + error ("-ms2600 is used without -ms."); + target_flags |= 1; + } } const char * diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5026976..708e8ee 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -458,6 +458,7 @@ static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code)); void override_options () { + int i; /* Comes from final.c -- no real reason to change it. */ #define MAX_CODE_ALIGN 16 @@ -509,7 +510,6 @@ override_options () if (ix86_arch_string != 0) { - int i; for (i = 0; i < pta_size; i++) if (! strcmp (ix86_arch_string, processor_alias_table[i].name)) { @@ -518,13 +518,13 @@ override_options () ix86_cpu = ix86_arch; break; } + if (i == pta_size) error ("bad value (%s) for -march= switch", ix86_arch_string); } if (ix86_cpu_string != 0) { - int i; for (i = 0; i < pta_size; i++) if (! strcmp (ix86_cpu_string, processor_alias_table[i].name)) { @@ -547,10 +547,11 @@ override_options () /* Validate registers in register allocation order. */ if (ix86_reg_alloc_order) { - int i, ch; + int ch; + for (i = 0; (ch = ix86_reg_alloc_order[i]) != '\0'; i++) { - int regno = 0; + int regno = -1; switch (ch) { @@ -562,53 +563,62 @@ override_options () case 'D': regno = 5; break; case 'B': regno = 6; break; - default: fatal ("Register '%c' is unknown", ch); + default: error ("Register '%c' is unknown", ch); } - if (regs_allocated[regno]) - fatal ("Register '%c' already specified in allocation order", ch); + if (regno >= 0) + { + if (regs_allocated[regno]) + error ("Register '%c' already specified in allocation order", + ch); - regs_allocated[regno] = 1; + regs_allocated[regno] = 1; + } } } /* Validate -mregparm= value. */ if (ix86_regparm_string) { - ix86_regparm = atoi (ix86_regparm_string); - if (ix86_regparm < 0 || ix86_regparm > REGPARM_MAX) - fatal ("-mregparm=%d is not between 0 and %d", - ix86_regparm, REGPARM_MAX); + i = atoi (ix86_regparm_string); + if (i < 0 || i > REGPARM_MAX) + error ("-mregparm=%d is not between 0 and %d", i, REGPARM_MAX); + else + ix86_regparm = i; } /* Validate -malign-loops= value, or provide default. */ ix86_align_loops = processor_target_table[ix86_cpu].align_loop; if (ix86_align_loops_string) { - ix86_align_loops = atoi (ix86_align_loops_string); - if (ix86_align_loops < 0 || ix86_align_loops > MAX_CODE_ALIGN) - fatal ("-malign-loops=%d is not between 0 and %d", - ix86_align_loops, MAX_CODE_ALIGN); + i = atoi (ix86_align_loops_string); + if (i < 0 || i > MAX_CODE_ALIGN) + error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN); + else + ix86_align_loops = i; } /* Validate -malign-jumps= value, or provide default. */ ix86_align_jumps = processor_target_table[ix86_cpu].align_jump; if (ix86_align_jumps_string) { - ix86_align_jumps = atoi (ix86_align_jumps_string); - if (ix86_align_jumps < 0 || ix86_align_jumps > MAX_CODE_ALIGN) - fatal ("-malign-jumps=%d is not between 0 and %d", - ix86_align_jumps, MAX_CODE_ALIGN); + i = atoi (ix86_align_jumps_string); + if (i < 0 || i > MAX_CODE_ALIGN) + error ("-malign-jumps=%d is not between 0 and %d", i, MAX_CODE_ALIGN); + else + ix86_align_jumps = i; } /* Validate -malign-functions= value, or provide default. */ ix86_align_funcs = processor_target_table[ix86_cpu].align_func; if (ix86_align_funcs_string) { - ix86_align_funcs = atoi (ix86_align_funcs_string); - if (ix86_align_funcs < 0 || ix86_align_funcs > MAX_CODE_ALIGN) - fatal ("-malign-functions=%d is not between 0 and %d", - ix86_align_funcs, MAX_CODE_ALIGN); + i = atoi (ix86_align_funcs_string); + if (i < 0 || i > MAX_CODE_ALIGN) + error ("-malign-functions=%d is not between 0 and %d", + i, MAX_CODE_ALIGN); + else + ix86_align_funcs = i; } /* Validate -mpreferred-stack-boundary= value, or provide default. @@ -616,20 +626,22 @@ override_options () ix86_preferred_stack_boundary = 128; if (ix86_preferred_stack_boundary_string) { - int i = atoi (ix86_preferred_stack_boundary_string); + i = atoi (ix86_preferred_stack_boundary_string); if (i < 2 || i > 31) - fatal ("-mpreferred-stack-boundary=%d is not between 2 and 31", i); - ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT; + error ("-mpreferred-stack-boundary=%d is not between 2 and 31", i); + else + ix86_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT; } /* Validate -mbranch-cost= value, or provide default. */ ix86_branch_cost = processor_target_table[ix86_cpu].branch_cost; if (ix86_branch_cost_string) { - ix86_branch_cost = atoi (ix86_branch_cost_string); - if (ix86_branch_cost < 0 || ix86_branch_cost > 5) - fatal ("-mbranch-cost=%d is not between 0 and 5", - ix86_branch_cost); + i = atoi (ix86_branch_cost_string); + if (i < 0 || i > 5) + error ("-mbranch-cost=%d is not between 0 and 5", i); + else + ix86_branch_cost = i; } /* Keep nonleaf frame pointers. */ diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 787ddd1..2fcf4ce 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1,5 +1,5 @@ /* Subroutines for code generation on Motorola 68HC11 and 68HC12. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@worldnet.fr) This file is part of GNU CC. @@ -761,7 +761,7 @@ m68hc11_emit_libcall (name, code, dmode, smode, noperands, operands) break; default: - fatal ("m68hc11_emit_libcall: Bad number of operands"); + abort (); } insns = get_insns (); diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 43d3421..430e618 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1,5 +1,5 @@ /* Subroutines for insn-output.c for Motorola 68000 family. - Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -90,41 +90,43 @@ void override_options () { int def_align; + int i; def_align = 1; /* Validate -malign-loops= value, or provide default */ + m68k_align_loops = def_align; if (m68k_align_loops_string) { - m68k_align_loops = atoi (m68k_align_loops_string); - if (m68k_align_loops < 1 || m68k_align_loops > MAX_CODE_ALIGN) - fatal ("-malign-loops=%d is not between 1 and %d", - m68k_align_loops, MAX_CODE_ALIGN); + i = atoi (m68k_align_loops_string); + if (i < 1 || i > MAX_CODE_ALIGN) + error ("-malign-loops=%d is not between 1 and %d", i, MAX_CODE_ALIGN); + else + m68k_align_loops = i; } - else - m68k_align_loops = def_align; /* Validate -malign-jumps= value, or provide default */ + m68k_align_jumps = def_align; if (m68k_align_jumps_string) { - m68k_align_jumps = atoi (m68k_align_jumps_string); - if (m68k_align_jumps < 1 || m68k_align_jumps > MAX_CODE_ALIGN) - fatal ("-malign-jumps=%d is not between 1 and %d", - m68k_align_jumps, MAX_CODE_ALIGN); + i = atoi (m68k_align_jumps_string); + if (i < 1 || i > MAX_CODE_ALIGN) + error ("-malign-jumps=%d is not between 1 and %d", i, MAX_CODE_ALIGN); + else + m68k_align_jumps = i; } - else - m68k_align_jumps = def_align; /* Validate -malign-functions= value, or provide default */ + m68k_align_funcs = def_align; if (m68k_align_funcs_string) { - m68k_align_funcs = atoi (m68k_align_funcs_string); - if (m68k_align_funcs < 1 || m68k_align_funcs > MAX_CODE_ALIGN) - fatal ("-malign-functions=%d is not between 1 and %d", - m68k_align_funcs, MAX_CODE_ALIGN); + i = atoi (m68k_align_funcs_string); + if (i < 1 || i > MAX_CODE_ALIGN) + error ("-malign-functions=%d is not between 1 and %d", + i, MAX_CODE_ALIGN); + else + m68k_align_funcs = i; } - else - m68k_align_funcs = def_align; } /* This function generates the assembly code for function entry. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 381001d..fbfa31f 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -4953,10 +4953,16 @@ override_options () if (! ISA_HAS_64BIT_REGS) { if (TARGET_FLOAT64) - fatal ("-mips%d does not support 64 bit fp registers", mips_isa); + { + error ("-mips%d does not support 64 bit fp registers", mips_isa); + target_flags &= ~ MASK_FLAG64; + } else if (TARGET_64BIT) - fatal ("-mips%d does not support 64 bit gp registers", mips_isa); + { + error ("-mips%d does not support 64 bit gp registers", mips_isa); + target_flags &= ~MASK_64BIT; + } } if (mips_abi != ABI_32 && mips_abi != ABI_O64) @@ -5572,8 +5578,7 @@ print_operand (file, op, letter) fputs (reg_names[GP_REG_FIRST], file); else if (letter == 'd' || letter == 'x' || letter == 'X') - fatal ("PRINT_OPERAND: letter %c was found & insn was not CONST_INT", - letter); + output_operand_lossage ("invalid use of %%d, %%x, or %%X"); else if (letter == 'B') fputs (code == EQ ? "z" : "n", file); @@ -6434,8 +6439,9 @@ save_restore_insns (store_p, large_reg, large_offset, file) - GET_MODE_SIZE (gpr_mode)); if (gp_offset < 0 || end_offset < 0) - fatal ("gp_offset (%ld) or end_offset (%ld) is less than zero.", - (long) gp_offset, (long) end_offset); + internal_error + ("gp_offset (%ld) or end_offset (%ld) is less than zero.", + (long) gp_offset, (long) end_offset); /* If we see a large frame in mips16 mode, we save the registers before adjusting the stack pointer, and load them afterward. */ @@ -6651,8 +6657,9 @@ save_restore_insns (store_p, large_reg, large_offset, file) end_offset = fp_offset - (current_frame_info.fp_reg_size - fp_size); if (fp_offset < 0 || end_offset < 0) - fatal ("fp_offset (%ld) or end_offset (%ld) is less than zero.", - (long) fp_offset, (long) end_offset); + internal_error + ("fp_offset (%ld) or end_offset (%ld) is less than zero.", + (long) fp_offset, (long) end_offset); else if (fp_offset < 32768) base_reg_rtx = stack_pointer_rtx, base_offset = 0; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66746f0..b03d481 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * decl.c (pushdecl): Call abort instead of fatal. + * except.c (decl_is_java_type): Call fatal_error instead of fatal. + * init.c (build_new_1): Likewise. + (build_java_class_ref): Call internal_error and fatal_error, not fatal. + * decl.c (build_typename_type): hash_table_init now returns void. + decl.c (init_decl_processing): Make an error non-fatal. + 2001-02-04 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (CLASSTYPE_INTERFACE_UNKNOWN): Fix formatting. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a250e67..13e3094 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3867,7 +3867,9 @@ pushdecl (x) else if (TREE_CODE (t) == PARM_DECL) { if (DECL_CONTEXT (t) == NULL_TREE) - fatal ("parse errors have confused me too much"); + /* This is probaby caused by too many errors, but calling + abort will say that if errors have occurred. */ + abort (); /* Check for duplicate params. */ if (duplicate_decls (x, t)) @@ -5520,16 +5522,15 @@ build_typename_type (context, name, fullname, base_type) { tree t; tree d; - struct hash_entry* e; + struct hash_entry *e; static struct hash_table ht; if (!ht.table) { static struct hash_table *h = &ht; - if (!hash_table_init (&ht, &hash_newfunc, &typename_hash, - &typename_compare)) - fatal ("virtual memory exhausted"); + + hash_table_init (&ht, &hash_newfunc, &typename_hash, &typename_compare); ggc_add_tree_hash_table_root (&h, 1); } @@ -6290,7 +6291,7 @@ init_decl_processing () /* Check to see that the user did not specify an invalid combination of command-line options. */ if (flag_new_abi && !flag_vtable_thunks) - fatal ("the new ABI requires vtable thunks"); + error ("the new ABI requires vtable thunks"); /* Create all the identifiers we need. */ initialize_predefined_identifiers (); @@ -7611,7 +7612,6 @@ check_initializer (decl, init) DECL_INITIAL (decl) = init; - /* This will keep us from needing to worry about our obstacks. */ my_friendly_assert (init != NULL_TREE, 149); init = NULL_TREE; } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 19d5eea..bcca686 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -466,8 +466,11 @@ decl_is_java_type (decl, err) { tree jthrow_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jthrowable")); + if (jthrow_node == NULL_TREE) - fatal ("call to Java `catch' or `throw', while `jthrowable' undefined"); + fatal_error + ("call to Java `catch' or `throw' with `jthrowable' undefined"); + jthrow_node = TREE_TYPE (TREE_TYPE (jthrow_node)); if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl))) diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1917389..7cd6c57 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1,6 +1,6 @@ /* Handle initialization things in C++. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000 Free Software Foundation, Inc. + 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -2205,9 +2205,10 @@ build_java_class_ref (type) CL_suffix = get_identifier("class$"); if (jclass_node == NULL_TREE) { - jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier("jclass")); + jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass")); if (jclass_node == NULL_TREE) - fatal("call to Java constructor, while `jclass' undefined"); + fatal_error ("call to Java constructor, while `jclass' undefined"); + jclass_node = TREE_TYPE (jclass_node); } @@ -2222,7 +2223,7 @@ build_java_class_ref (type) break; } if (!field) - fatal ("Can't find class$"); + internal_error ("Can't find class$"); } else name = build_static_name (type, CL_suffix); @@ -2398,7 +2399,9 @@ build_new_1 (exp) use_java_new = 1; alloc_decl = IDENTIFIER_GLOBAL_VALUE (get_identifier (alloc_name)); if (alloc_decl == NULL_TREE) - fatal("call to Java constructor, while `%s' undefined", alloc_name); + fatal_error ("call to Java constructor with `%s' undefined", + alloc_name); + class_addr = build1 (ADDR_EXPR, jclass_node, class_decl); alloc_call = (build_function_call (alloc_decl, diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 9a99480..2dccd4c 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1,5 +1,5 @@ /* Language-independent diagnostic subroutines for the GNU C compiler - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@codesourcery.com> This file is part of GNU CC. @@ -1108,23 +1108,32 @@ fnotice VPARAMS ((FILE *file, const char *msgid, ...)) } -/* Print a fatal error message. NAME is the text. +/* Print a fatal I/O error message. Argument are like printf. Also include a system error message based on `errno'. */ void -pfatal_with_name (name) - const char *name; +fatal_io_error VPARAMS ((const char *msgid, ...)) { - fprintf (stderr, "%s: ", progname); - perror (name); - exit (FATAL_EXIT_CODE); -} +#ifndef ANSI_PROTOTYPES + const char *msgid; +#endif + va_list ap; + output_state os; -void -fatal_io_error (name) - const char *name; -{ - verbatim ("%s: %s: I/O error\n", progname, name); + os = output_buffer_state (diagnostic_buffer); + VA_START (ap, msgid); + +#ifndef ANSI_PROTOTYPES + msgid = va_arg (ap, const char *); +#endif + + output_printf (diagnostic_buffer, "%s: %s: ", progname, xstrerror (errno)); + output_buffer_ptr_to_format_args (diagnostic_buffer) = ≈ + output_buffer_text_cursor (diagnostic_buffer) = msgid; + output_format (diagnostic_buffer); + finish_diagnostic (); + output_buffer_state (diagnostic_buffer) = os; + va_end (ap); exit (FATAL_EXIT_CODE); } @@ -1368,6 +1377,8 @@ error_for_asm VPARAMS ((rtx insn, const char *msgid, ...)) va_end (ap); } +/* Report an error message. The arguments are like that of printf. */ + void error VPARAMS ((const char *msgid, ...)) { @@ -1389,22 +1400,49 @@ error VPARAMS ((const char *msgid, ...)) va_end (ap); } -/* Report a fatal error at the current line number. Allow a front end to +/* Likewise, except that the compilation is terminated after printing the + error message. */ + +void +fatal_error VPARAMS ((const char *msgid, ...)) +{ +#ifndef ANSI_PROTOTYPES + const char *msgid; +#endif + va_list ap; + diagnostic_context dc; + + VA_START (ap, msgid); + +#ifndef ANSI_PROTOTYPES + msgid = va_arg (ap, const char *); +#endif + + set_diagnostic_context + (&dc, msgid, &ap, input_filename, lineno, /* warn = */ 0); + report_diagnostic (&dc); + va_end (ap); + + fprintf (stderr, "compilation terminated.\n"); + exit (FATAL_EXIT_CODE); +} + +/* Report a compiler error at the current line number. Allow a front end to intercept the message. */ -static void (*fatal_function) PARAMS((const char *, va_list *)); +static void (*internal_error_function) PARAMS ((const char *, va_list *)); -/* Set the function to call when a fatal error occurs. */ +/* Set the function to call when a compiler error occurs. */ void -set_fatal_function (f) +set_internal_error_function (f) void (*f) PARAMS ((const char *, va_list *)); { - fatal_function = f; + internal_error_function = f; } void -fatal VPARAMS ((const char *msgid, ...)) +internal_error VPARAMS ((const char *msgid, ...)) { #ifndef ANSI_PROTOTYPES const char *msgid; @@ -1424,15 +1462,16 @@ fatal VPARAMS ((const char *msgid, ...)) exit (FATAL_EXIT_CODE); } - if (fatal_function != 0) - (*fatal_function) (_(msgid), &ap); + if (internal_error_function != 0) + (*internal_error_function) (_(msgid), &ap); set_diagnostic_context (&dc, msgid, &ap, input_filename, lineno, /* warn = */0); report_diagnostic (&dc); va_end (ap); - fprintf (stderr, "Please submit a full bug report, with preprocessed source if appropriate.\n"); + fprintf (stderr, "Please submit a full bug report, "); + fprintf (stderr, "with preprocessed source if appropriate.\n"); fprintf (stderr, "See %s for instructions.\n", GCCBUGURL); exit (FATAL_EXIT_CODE); } @@ -1661,7 +1700,8 @@ error_recursion () if (diagnostic_lock < 3) finish_diagnostic (); - fatal ("Internal compiler error: Error reporting routines re-entered."); + internal_error + ("Internal compiler error: Error reporting routines re-entered."); } /* Given a partial pathname as input, return another pathname that @@ -1718,8 +1758,8 @@ fancy_abort (file, line, function) int line; const char *function; { - fatal ("Internal compiler error in %s, at %s:%d", - function, trim_filename (file), line); + internal_error ("Internal compiler error in %s, at %s:%d", + function, trim_filename (file), line); } /* Setup DC for reporting a diagnostic MESSAGE (an error or a WARNING), diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 3ae06a7..5217e38 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -169,7 +169,7 @@ extern output_buffer *diagnostic_buffer; extern void set_diagnostic_context PARAMS ((diagnostic_context *, const char *, va_list *, const char *, int, int)); -extern void set_fatal_function PARAMS ((void (*) +extern void set_internal_error_function PARAMS ((void (*) PARAMS ((const char *, va_list *)))); extern void report_diagnostic PARAMS ((diagnostic_context *)); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 04bfdbc..e424086 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3181,8 +3181,8 @@ get_cfa_from_loc_descr (cfa, loc) cfa->offset = ptr->dw_loc_oprnd1.v.val_unsigned; break; default: - fatal ("DW_LOC_OP %s not implememnted yet.\n", - dwarf_stack_op_name (ptr->dw_loc_opc)); + internal_error ("DW_LOC_OP %s not implememnted\n", + dwarf_stack_op_name (ptr->dw_loc_opc)); } } } diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index ff73b84..9c7cb47 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -5711,7 +5711,8 @@ dwarfout_init (asm_out_file, main_input_filename) register char *dirname; if (!pwd) - pfatal_with_name ("getpwd"); + fatal_io_error ("can't get current directory"); + dirname = concat (pwd, "/", NULL); ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname); free (dirname); diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 8291a7a..0b9e4aa 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1001,7 +1001,8 @@ gen_realpart (mode, x) && GET_MODE_BITSIZE (mode) < BITS_PER_WORD && REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER) - fatal ("Unable to access real part of complex value in a hard register on this target"); + internal_error + ("Can't access real part of complex value in hard register"); else if (WORDS_BIG_ENDIAN) return gen_highpart (mode, x); else @@ -1024,7 +1025,8 @@ gen_imagpart (mode, x) && GET_MODE_BITSIZE (mode) < BITS_PER_WORD && REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER) - fatal ("Unable to access imaginary part of complex value in a hard register on this target"); + internal_error + ("can't access imaginary part of complex value in hard register"); else return gen_highpart (mode, x); } diff --git a/gcc/except.c b/gcc/except.c index d923b70..4770031 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -967,7 +967,8 @@ duplicate_eh_handlers (old_note_eh_region, new_note_eh_region, map) region = find_func_region (old_note_eh_region); if (region == -1) - fatal ("Cannot duplicate non-existant exception region."); + /* Cannot duplicate non-existant exception region. */ + abort (); /* duplicate_eh_handlers may have been called during a symbol remap. */ new_region = find_func_region (new_note_eh_region); @@ -5831,6 +5831,7 @@ var_rtx (exp) } #ifdef MAX_INTEGER_COMPUTATION_MODE + void check_max_integer_computation_mode (exp) tree exp; @@ -5856,7 +5857,7 @@ check_max_integer_computation_mode (exp) mode = TYPE_MODE (TREE_TYPE (exp)); if (GET_MODE_CLASS (mode) == MODE_INT && mode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); } /* Check operand of a unary op. */ @@ -5865,7 +5866,7 @@ check_max_integer_computation_mode (exp) mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); if (GET_MODE_CLASS (mode) == MODE_INT && mode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); } /* Check operands of a binary/comparison op. */ @@ -5874,12 +5875,12 @@ check_max_integer_computation_mode (exp) mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))); if (GET_MODE_CLASS (mode) == MODE_INT && mode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))); if (GET_MODE_CLASS (mode) == MODE_INT && mode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); } } #endif @@ -6037,7 +6038,7 @@ expand_expr (exp, target, tmode, modifier) if (GET_MODE_CLASS (mode) == MODE_INT && mode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); } if (tmode != mode @@ -6052,7 +6053,7 @@ expand_expr (exp, target, tmode, modifier) && TREE_CODE (exp) != RTL_EXPR && GET_MODE_CLASS (tmode) == MODE_INT && tmode > MAX_INTEGER_COMPUTATION_MODE) - fatal ("unsupported wide integer operation"); + internal_error ("unsupported wide integer operation"); check_max_integer_computation_mode (exp); #endif diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 315640f..745890c 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,12 @@ +Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * com.c (ffecom_init_0): Call fatal_error instead of fatal. + * com.c (init_parse): Call fatal_io_error instead of + pfatal_with_name. + (ffecom_decode_include_option_): Make errors non-fatal. + * lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. + (ffelex_hash_): Likewise. + Sat Jan 27 20:52:18 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * Make-lang.in: Remove all dependencies on defaults.h. diff --git a/gcc/f/com.c b/gcc/f/com.c index 2fd237a..198a1f7 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -11855,7 +11855,7 @@ ffecom_init_0 () /* Set up pointer types. */ if (ffecom_pointer_kind_ == FFEINFO_basictypeNONE) - fatal ("no INTEGER type can hold a pointer on this configuration"); + fatal_error ("no INTEGER type can hold a pointer on this configuration"); else if (0 && ffe_is_do_internal_checks ()) fprintf (stderr, "Pointer type kt=%d\n", ffecom_pointer_kind_); ffetype_set_kind (ffeinfo_type (FFEINFO_basictypeINTEGER, @@ -14608,7 +14608,7 @@ init_parse (filename) else finput = fopen (filename, "r"); if (finput == 0) - pfatal_with_name (filename); + fatal_io_error ("can't open %s", filename); #ifdef IO_BUFFER_SIZE setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); @@ -16078,12 +16078,12 @@ ffecom_decode_include_option_ (char *spec) dirtmp = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); dirtmp->next = 0; /* New one goes on the end */ - if (spec[0] != 0) - dirtmp->fname = spec; - else - fatal ("Directory name must immediately follow -I option with no intervening spaces, as in `-Idir', not `-I dir'"); + dirtmp->fname = spec; dirtmp->got_name_map = 0; - append_include_chain (dirtmp, dirtmp); + if (spec[0] == 0) + error ("Directory name must immediately follow -I"); + else + append_include_chain (dirtmp, dirtmp); } return 1; } diff --git a/gcc/f/lex.c b/gcc/f/lex.c index 4c90f26..ea0ef05 100644 --- a/gcc/f/lex.c +++ b/gcc/f/lex.c @@ -1,5 +1,5 @@ /* Implementation of Fortran lexer - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc. Contributed by James Craig Burley. This file is part of GNU Fortran. @@ -803,7 +803,7 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c) case EOF: case '\n': - fatal ("Badly formed directive -- no closing quote"); + error ("Badly formed directive -- no closing quote"); done = TRUE; break; @@ -1036,7 +1036,7 @@ ffelex_get_directive_line_ (char **text, FILE *finput) || c == EOF) { if (looking_for != 0) - fatal ("Bad directive -- missing close-quote"); + error ("Bad directive -- missing close-quote"); *p++ = '\0'; *text = directive_buffer; @@ -1366,7 +1366,7 @@ ffelex_hash_ (FILE *finput) { lineno = 1; input_filename = old_input_filename; - fatal ("Use `#line ...' instead of `# ...' in first line"); + error ("Use `#line ...' instead of `# ...' in first line"); } if (num == 1) @@ -1410,7 +1410,7 @@ ffelex_hash_ (FILE *finput) { lineno = 1; input_filename = old_input_filename; - fatal ("Use `#line ...' instead of `# ...' in first line"); + error ("Use `#line ...' instead of `# ...' in first line"); } } else @@ -6948,7 +6948,9 @@ verify_flow_info () basic_block bb = NOTE_BASIC_BLOCK (x); num_bb_notes++; if (bb->index != last_bb_num_seen + 1) - fatal ("Basic blocks not numbered consecutively"); + /* Basic blocks not numbered consecutively. */ + abort (); + last_bb_num_seen = bb->index; } @@ -6988,8 +6990,9 @@ verify_flow_info () } if (num_bb_notes != n_basic_blocks) - fatal ("number of bb notes in insn chain (%d) != n_basic_blocks (%d)", - num_bb_notes, n_basic_blocks); + internal_error + ("number of bb notes in insn chain (%d) != n_basic_blocks (%d)", + num_bb_notes, n_basic_blocks); if (err) abort (); diff --git a/gcc/graph.c b/gcc/graph.c index 8718319..0f9e4ef 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -1,23 +1,23 @@ /* Output routines for graphical representation. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. - This file is part of GNU CC. +This file is part of GNU CC. - GNU CC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. - GNU CC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with GNU CC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ #include <config.h> #include "system.h" @@ -399,6 +399,7 @@ print_rtl_graph_with_bb (base, suffix, rtx_first) /* Similar as clean_dump_file, but this time for graph output files. */ + void clean_graph_dump_file (base, suffix) const char *base; @@ -417,7 +418,7 @@ clean_graph_dump_file (base, suffix) fp = fopen (buf, "w"); if (fp == NULL) - pfatal_with_name (buf); + fatal_io_error ("can't open %s", buf); switch (graph_dump_format) { @@ -1,5 +1,5 @@ /* hash.c -- hash table routines - Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1998, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> This file was lifted from BFD, the Binary File Descriptor library. @@ -30,11 +30,11 @@ Boston, MA 02111-1307, USA. */ #define obstack_chunk_free free /* The default number of entries to use when creating a hash table. */ -#define DEFAULT_SIZE (1009) +#define DEFAULT_SIZE 1009 /* Create a new hash table, given a number of entries. */ -boolean +void hash_table_init_n (table, newfunc, hash, comp, size) struct hash_table *table; struct hash_entry *(*newfunc) PARAMS ((struct hash_entry *, @@ -47,29 +47,19 @@ hash_table_init_n (table, newfunc, hash, comp, size) unsigned int alloc; alloc = size * sizeof (struct hash_entry *); - if (!obstack_begin (&table->memory, alloc)) - { - error ("no memory"); - return false; - } + obstack_begin (&table->memory, alloc); table->table = ((struct hash_entry **) obstack_alloc (&table->memory, alloc)); - if (!table->table) - { - error ("no memory"); - return false; - } memset ((PTR) table->table, 0, alloc); table->size = size; table->newfunc = newfunc; table->hash = hash; table->comp = comp; - return true; } /* Create a new hash table with the default number of entries. */ -boolean +void hash_table_init (table, newfunc, hash, comp) struct hash_table *table; struct hash_entry *(*newfunc) PARAMS ((struct hash_entry *, @@ -78,7 +68,7 @@ hash_table_init (table, newfunc, hash, comp) unsigned long (*hash) PARAMS ((hash_table_key)); boolean (*comp) PARAMS ((hash_table_key, hash_table_key)); { - return hash_table_init_n (table, newfunc, hash, comp, DEFAULT_SIZE); + hash_table_init_n (table, newfunc, hash, comp, DEFAULT_SIZE); } /* Free a hash table. */ @@ -108,23 +98,21 @@ hash_lookup (table, key, create, copy) hash = (*table->hash)(key); index = hash % table->size; - for (hashp = table->table[index]; - hashp != (struct hash_entry *) NULL; - hashp = hashp->next) - { - if (hashp->hash == hash - && (*table->comp)(hashp->key, key)) - return hashp; - } + for (hashp = table->table[index]; hashp != 0; hashp = hashp->next) + if (hashp->hash == hash + && (*table->comp)(hashp->key, key)) + return hashp; if (! create) - return (struct hash_entry *) NULL; + return 0; hashp = (*table->newfunc) ((struct hash_entry *) NULL, table, key); - if (hashp == (struct hash_entry *) NULL) - return (struct hash_entry *) NULL; + if (hashp == 0) + return 0; + if (copy) key = (*copy) (&table->memory, key); + hashp->key = key; hashp->hash = hash; hashp->next = table->table[index]; @@ -135,14 +123,13 @@ hash_lookup (table, key, create, copy) /* Base method for creating a new hash table entry. */ -/*ARGSUSED*/ struct hash_entry * hash_newfunc (entry, table, p) struct hash_entry *entry; struct hash_table *table; hash_table_key p ATTRIBUTE_UNUSED; { - if (entry == (struct hash_entry *) NULL) + if (entry == 0) entry = ((struct hash_entry *) hash_allocate (table, sizeof (struct hash_entry))); return entry; @@ -155,12 +142,7 @@ hash_allocate (table, size) struct hash_table *table; unsigned int size; { - PTR ret; - - ret = obstack_alloc (&table->memory, size); - if (ret == NULL && size != 0) - error ("no memory"); - return ret; + return obstack_alloc (&table->memory, size); } /* Traverse a hash table. */ @@ -172,17 +154,12 @@ hash_traverse (table, func, info) PTR info; { unsigned int i; + struct hash_entry *p; for (i = 0; i < table->size; i++) - { - struct hash_entry *p; - - for (p = table->table[i]; p != NULL; p = p->next) - { - if (! (*func) (p, info)) - return; - } - } + for (p = table->table[i]; p != 0; p = p->next) + if (! (*func) (p, info)) + return; } /* Hash a string. Return a hash-code for the string. */ @@ -206,6 +183,7 @@ string_hash (k) hash ^= hash >> 2; ++len; } + hash += len + (len << 17); hash ^= hash >> 2; @@ -227,18 +205,13 @@ string_compare (k1, k2) hash_table_key string_copy (memory, k) - struct obstack* memory; + struct obstack *memory; hash_table_key k; { char *new; - char *string = (char*) k; + char *string = (char *) k; new = (char *) obstack_alloc (memory, strlen (string) + 1); - if (!new) - { - error ("no memory"); - return NULL; - } strcpy (new, string); return new; @@ -1,5 +1,5 @@ /* Header file for generic hash table support. - Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1997, 1998, 2001 Free Software Foundation, Inc. Written by Steve Chamberlain <sac@cygnus.com> This file was lifted from BFD, the Binary File Descriptor library. @@ -76,7 +76,7 @@ struct hash_table }; /* Initialize a hash table. */ -extern boolean hash_table_init +extern void hash_table_init PARAMS ((struct hash_table *, struct hash_entry *(*) (struct hash_entry *, struct hash_table *, @@ -85,7 +85,7 @@ extern boolean hash_table_init boolean (*comp) (hash_table_key, hash_table_key))); /* Initialize a hash table specifying a size. */ -extern boolean hash_table_init_n +extern void hash_table_init_n PARAMS ((struct hash_table *, struct hash_entry *(*) (struct hash_entry *, struct hash_table *, diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index faba27c..ad17577 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,58 @@ +Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + + * check-init.c (check_init): Call internal_error instead of fatal. + * expr.c (java_lang_expand_expr): Likewise. + * jcf-parse.c (get_constant): Likewise. + * mangle.c (java_mangle_decl): Likewise. + * parse.y (make_nested_class_name, java_complete_lhs): Likewise. + (operator_string): Likewise. + * check-init.c (check_init): Call abort instead of fatal. + * class.c (build_class_ref): Likewise. + * constants.c (write_constant_pool): Likewise. + * decl.c (start_java_method): Likewise. + * 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-tree.h (INNER_CLASS_P): Likewise. + * jcf-parse.c (parse_signature, get_name_constant): Likewise. + (give_name_to_class, get_class_constant): Likewise. + * jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. + (find_constant_index, generate_bytecode_conditional): Likewise. + (generate_bytecode_insns, perform_relocations): Likewise. + * lex.c (java_unget_unicode, java_lex): Likewise. + * mangle.c (mangle_type, mangle_record_type): Likewise. + (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. + (finish_mangling): Likewise. + * parse.h (MARK_FINAL_PARMS): Likewise. + * 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. + * typeck.c (set_local_type, parse_signature_type): Likewise. + (parse_signature_string, build_java_signature): Likewise; + (set_java_signature): Likewise. + * verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. + * class.c (add_method): Call fatal_error instead of fatal. + (build_static_field_ref): Likewise. + * expr.c (build_known_method_ref, expand_invoke): Likewise. + * jcf-parse.c (get_constant, jcf_parse): Likewise. + * lex.c (java_new_new_lexer): Likewise. + * jv-scan.c (main): Likewise. + (fatal_error): Renamed from fatal. + * jcf-parse.c (yyparse): Call fatal_io_error instead of + pfatal_with_name. + * jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. + (yyparse): Likewise. + * jcf-write.c (make_class_file_name, write_classfile): Likewise. + * lex.c (java_get_line_col): Likewise. + * jcf-parse.c (load_class): Make errors non-fatal. + * lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. + 2001-02-01 Bryce McKinlay <bryce@albatross.co.nz> * jvgenmain.c (class_mangling_suffix): Remove unused string. diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index 7de0e18..9d89196 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -1,6 +1,5 @@ /* Code to test for "definitive assignment". - - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -464,7 +463,7 @@ check_init (exp, before) words when_false = tmp + num_current_words; #ifdef ENABLE_JC1_CHECKING if (TREE_CODE (alt->block) != LOOP_EXPR) - fatal ("internal error in check-init: EXIT_EXPR not in LOOP_EXPR"); + abort (); #endif check_bool_init (TREE_OPERAND (exp, 0), before, when_false, when_true); done_alternative (when_true, alt); @@ -535,7 +534,7 @@ check_init (exp, before) struct alternatives *alt = alternatives; #ifdef ENABLE_JC1_CHECKING if (TREE_CODE (alt->block) != CLEANUP_POINT_EXPR) - fatal ("internal error in check-init: WITH_CLEANUP_EXPR not in CLEANUP_POINT_EXPR"); + abort (); #endif check_init (TREE_OPERAND (exp, 0), before); UNION (alt->combined, alt->combined, before); @@ -728,8 +727,9 @@ check_init (exp, before) break; default: - fatal ("internal error in check-init: tree code not implemented: %s", - tree_code_name [(int) TREE_CODE (exp)]); + internal_error + ("internal error in check-init: tree code not implemented: %s", + tree_code_name [(int) TREE_CODE (exp)]); } } diff --git a/gcc/java/class.c b/gcc/java/class.c index b0b4719..615c075 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1,5 +1,6 @@ /* Functions related to building classes and their related objects. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -692,9 +693,12 @@ add_method (this_class, access_flags, name, method_sig) { tree handle_class = CLASS_TO_HANDLE_TYPE (this_class); tree function_type, fndecl; - const unsigned char *sig = (const unsigned char*)IDENTIFIER_POINTER (method_sig); + const unsigned char *sig + = (const unsigned char *) IDENTIFIER_POINTER (method_sig); + if (sig[0] != '(') - fatal ("bad method signature"); + fatal_error ("bad method signature"); + function_type = get_type_from_signature (method_sig); fndecl = add_method_1 (handle_class, access_flags, name, function_type); set_java_signature (TREE_TYPE (fndecl), method_sig); @@ -928,7 +932,8 @@ build_class_ref (type) else if (type == void_type_node) prim_class_name = "java.lang.Void"; else - fatal ("internal error - bad type to build_class_ref"); + abort (); + prim_class = lookup_class (get_identifier (prim_class_name)); return build (COMPONENT_REF, NULL_TREE, prim_class, TYPE_identifier_node); @@ -1000,8 +1005,8 @@ build_static_field_ref (fdecl) if (fld == fdecl) break; if (fld == NULL_TREE) - fatal ("field '%s' not found in class", - IDENTIFIER_POINTER (DECL_NAME (fdecl))); + fatal_error ("field '%s' not found in class", + IDENTIFIER_POINTER (DECL_NAME (fdecl))); if (FIELD_STATIC (fld)) field_index++; } diff --git a/gcc/java/constants.c b/gcc/java/constants.c index ee7be0b..0dcd715 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -268,10 +268,10 @@ count_constant_pool_bytes (cpool) void write_constant_pool (cpool, buffer, length) CPool *cpool; - unsigned char* buffer; + unsigned char *buffer; int length; { - unsigned char* ptr = buffer; + unsigned char *ptr = buffer; int i = 1; jword *datap = &cpool->data[1]; PUT2 (cpool->count); @@ -311,8 +311,9 @@ write_constant_pool (cpool, buffer, length) break; } } + if (ptr != buffer + length) - fatal("internal error - incorrect constant pool"); + abort (); } CPool *outgoing_cpool; diff --git a/gcc/java/decl.c b/gcc/java/decl.c index a19d06d..f596059 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1,6 +1,7 @@ /* Process declarations and variables for the GNU compiler for the Java(TM) language. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -1817,8 +1818,8 @@ start_java_method (fndecl) { tree parm_name = NULL_TREE, parm_decl; tree parm_type = TREE_VALUE (tem); - if (i >= DECL_MAX_LOCALS(fndecl)) - fatal ("function has more parameters than local slots"); + if (i >= DECL_MAX_LOCALS (fndecl)) + abort (); parm_decl = build_decl (PARM_DECL, parm_name, parm_type); DECL_CONTEXT (parm_decl) = fndecl; diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 16653ec..d74dfc0 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1,5 +1,6 @@ /* Process expressions for the GNU compiler for the Java(TM) language. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -279,7 +280,7 @@ push_type (type) tree type; { if (! push_type_0 (type)) - fatal ("stack overflow"); + abort (); } static void @@ -497,14 +498,17 @@ java_stack_pop (count) while (count > 0) { tree type, val; + if (stack_pointer == 0) - fatal ("stack underflow"); + abort (); + type = stack_type_map[stack_pointer - 1]; if (type == TYPE_SECOND) { count--; if (stack_pointer == 1 || count <= 0) - fatal ("stack underflow"); + abort (); + type = stack_type_map[stack_pointer - 2]; } val = pop_value (type); @@ -526,7 +530,8 @@ java_stack_swap () || (type2 = stack_type_map[stack_pointer - 2]) == TYPE_UNKNOWN || type1 == TYPE_SECOND || type2 == TYPE_SECOND || TYPE_IS_WIDE (type1) || TYPE_IS_WIDE (type2)) - fatal ("bad stack swap"); + /* Bad stack swap. */ + abort (); flush_quick_stack (); decl1 = find_stack_slot (stack_pointer - 1, type1); @@ -562,15 +567,18 @@ java_stack_dup (size, offset) if (type == TYPE_SECOND) { if (src_index <= low_index) - fatal ("dup operation splits 64-bit number"); + /* Dup operation splits 64-bit number. */ + abort (); + stack_type_map[dst_index] = type; src_index--; dst_index--; type = stack_type_map[src_index]; if (! TYPE_IS_WIDE (type)) - fatal ("internal error - dup operation"); + abort (); } else if (TYPE_IS_WIDE (type)) - fatal ("internal error - dup operation"); + abort (); + if (src_index != dst_index) { tree src_decl = find_stack_slot (src_index, type); @@ -669,7 +677,7 @@ encode_newarray_type (type) else if (type == long_type_node) return 11; else - fatal ("Can't compute type code - patch_newarray"); + abort (); } /* Build a call to _Jv_ThrowBadArrayIndex(), the @@ -695,11 +703,14 @@ build_java_array_length_access (node) { tree type = TREE_TYPE (node); HOST_WIDE_INT length; + if (!is_array_type_p (type)) - fatal ("array length on a non-array reference"); + abort (); + length = java_array_type_length (type); if (length >= 0) return build_int_2 (length, 0); + return fold (build1 (INDIRECT_REF, int_type_node, fold (build (PLUS_EXPR, ptr_type_node, @@ -807,7 +818,7 @@ build_java_check_indexed_type (array_node, indexed_type) tree elt_type; if (!is_array_type_p (TREE_TYPE (array_node))) - fatal ("array indexing on a non-array reference"); + abort (); elt_type = (TYPE_ARRAY_ELEMENT (TREE_TYPE (TREE_TYPE (array_node)))); @@ -819,7 +830,7 @@ build_java_check_indexed_type (array_node, indexed_type) return boolean_type_node; if (indexed_type != elt_type ) - fatal ("type array element mismatch"); + abort (); else return indexed_type; } @@ -1041,7 +1052,8 @@ expand_java_pushc (ival, type) value = build_real (type, x); } else - fatal ("internal error in expand_java_pushc"); + abort (); + push_value (value); } @@ -1257,7 +1269,7 @@ build_java_soft_divmod (op, type, op1, op2) } if (! call) - fatal ("Internal compiler error in build_java_soft_divmod"); + abort (); call = build (CALL_EXPR, type, build_address_of (call), @@ -1733,8 +1745,8 @@ build_known_method_ref (method, method_type, self_type, method_signature, arg_li if (method == meth) break; if (meth == NULL_TREE) - fatal ("method '%s' not found in class", - IDENTIFIER_POINTER (DECL_NAME (method))); + fatal_error ("method '%s' not found in class", + IDENTIFIER_POINTER (DECL_NAME (method))); method_index++; } method_index *= int_size_in_bytes (method_type_node); @@ -1831,7 +1843,7 @@ build_invokeinterface (dtable, method) break; } if (meth == NULL_TREE) - fatal ("internal error in build_invokeinterface"); + abort (); } lookup_arg = tree_cons (NULL_TREE, dtable, @@ -1858,7 +1870,8 @@ expand_invoke (opcode, method_ref_index, nargs) tree method_name = COMPONENT_REF_NAME (¤t_jcf->cpool, method_ref_index); tree self_type = get_class_constant (current_jcf, COMPONENT_REF_CLASS_INDEX(¤t_jcf->cpool, method_ref_index)); - const char *self_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type))); + const char *self_name + = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type))); tree call, func, method, arg_list, method_type; tree cond = NULL_TREE; @@ -1867,7 +1880,7 @@ expand_invoke (opcode, method_ref_index, nargs) load_class (self_type, 1); safe_layout_class (self_type); if (TREE_CODE (TYPE_SIZE (self_type)) == ERROR_MARK) - fatal ("failed to find class '%s'", self_name); + fatal_error ("failed to find class '%s'", self_name); } layout_class_methods (self_type); @@ -2501,8 +2514,7 @@ java_lang_expand_expr (exp, target, tmode, modifier) return const0_rtx; default: - fatal ("Can't expand '%s' tree - java_lang_expand_expr", - tree_code_name [TREE_CODE (exp)]); + internal_error ("Can't expand %s", tree_code_name [TREE_CODE (exp)]); } } diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index c390432..7aeab9a 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1415,7 +1415,7 @@ extern tree *type_map; INNER_CLASS_DECL_P (NODE) : \ (TREE_CODE (NODE) == RECORD_TYPE ? \ INNER_CLASS_TYPE_P (NODE) : \ - (fatal ("INNER_CLASS_P: Wrong node type"), 0))) + (abort (), 0))) /* On a TYPE_DECL, hold the list of inner classes defined within the scope of TYPE_DECL. */ diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 24eb0a3..7cc1de6 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -240,14 +240,12 @@ parse_signature (jcf, sig_index) JCF *jcf; int sig_index; { - if (sig_index <= 0 || sig_index >= JPOOL_SIZE(jcf) + if (sig_index <= 0 || sig_index >= JPOOL_SIZE (jcf) || JPOOL_TAG (jcf, sig_index) != CONSTANT_Utf8) - fatal ("invalid field/method signature"); + abort (); else - { - return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index), - JPOOL_UTF_LENGTH (jcf, sig_index)); - } + return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index), + JPOOL_UTF_LENGTH (jcf, sig_index)); } void @@ -364,7 +362,8 @@ get_constant (jcf, index) { int char_len = UT8_CHAR_LENGTH (*utf8); if (char_len < 0 || char_len > 3 || char_len > i) - fatal ("bad string constant"); + fatal_error ("bad string constant"); + utf8 += char_len; i -= char_len; str_len++; @@ -415,12 +414,12 @@ get_constant (jcf, index) default: goto bad; } - JPOOL_TAG(jcf, index) = tag | CONSTANT_ResolvedFlag; + JPOOL_TAG (jcf, index) = tag | CONSTANT_ResolvedFlag; jcf->cpool.data [index] = (jword) value; return value; bad: - fatal ("bad value constant type %d, index %d", - JPOOL_TAG( jcf, index ), index); + internal_error ("bad value constant type %d, index %d", + JPOOL_TAG (jcf, index), index); } tree @@ -429,8 +428,10 @@ get_name_constant (jcf, index) int index; { tree name = get_constant (jcf, index); + if (TREE_CODE (name) != IDENTIFIER_NODE) - fatal ("bad nameandtype index %d", index); + abort (); + return name; } @@ -479,9 +480,9 @@ give_name_to_class (jcf, i) JCF *jcf; int i; { - if (i <= 0 || i >= JPOOL_SIZE(jcf) + if (i <= 0 || i >= JPOOL_SIZE (jcf) || JPOOL_TAG (jcf, i) != CONSTANT_Class) - fatal ("bad class index %d", i); + abort (); else { tree this_class; @@ -507,9 +508,9 @@ tree get_class_constant (JCF *jcf , int i) { tree type; - if (i <= 0 || i >= JPOOL_SIZE(jcf) + if (i <= 0 || i >= JPOOL_SIZE (jcf) || (JPOOL_TAG (jcf, i) & ~CONSTANT_ResolvedFlag) != CONSTANT_Class) - fatal ("bad class index %d", i); + abort (); if (JPOOL_TAG (jcf, i) != CONSTANT_ResolvedClass) { @@ -517,6 +518,7 @@ get_class_constant (JCF *jcf , int i) /* verify_constant_pool confirmed that name_index is a CONSTANT_Utf8. */ 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)); else @@ -614,7 +616,7 @@ load_class (class_or_name, verbose) name = DECL_NAME (TYPE_NAME (class_or_name)); if (read_class (name) == 0 && verbose) - fatal ("Cannot find file for class %s.", IDENTIFIER_POINTER (name)); + error ("Cannot find file for class %s.", IDENTIFIER_POINTER (name)); } /* Parse a source file when JCF refers to a source file. */ @@ -637,12 +639,10 @@ jcf_parse_source () if (!HAS_BEEN_ALREADY_PARSED_P (file)) { if (!(finput = fopen (input_filename, "r"))) - fatal ("input file `%s' just disappeared - jcf_parse_source", - input_filename); + fatal_io_error ("can't reopen %s", input_filename); parse_source_file (file, finput); if (fclose (finput)) - fatal ("can't close input file `%s' stream - jcf_parse_source", - input_filename); + fatal_io_error ("can't close %s", input_filename); } java_pop_parser_context (IS_A_COMMAND_LINE_FILENAME_P (file)); java_parser_context_restore_global (); @@ -658,13 +658,13 @@ jcf_parse (jcf) tree current; if (jcf_parse_preamble (jcf) != 0) - fatal ("Not a valid Java .class file.\n"); + fatal_error ("not a valid Java .class file"); code = jcf_parse_constant_pool (jcf); if (code != 0) - fatal ("error while parsing constant pool"); + fatal_error ("error while parsing constant pool"); code = verify_constant_pool (jcf); if (code > 0) - fatal ("error in constant pool entry #%d\n", code); + fatal_error ("error in constant pool entry #%d\n", code); jcf_parse_class (jcf); if (main_class == NULL_TREE) @@ -689,13 +689,13 @@ jcf_parse (jcf) code = jcf_parse_fields (jcf); if (code != 0) - fatal ("error while parsing fields"); + fatal_error ("error while parsing fields"); code = jcf_parse_methods (jcf); if (code != 0) - fatal ("error while parsing methods"); + fatal_error ("error while parsing methods"); code = jcf_parse_final_attributes (jcf); if (code != 0) - fatal ("error while parsing final attributes"); + fatal_error ("error while parsing final attributes"); /* The fields of class_type_node are already in correct order. */ if (current_class != class_type_node && current_class != object_type_node) @@ -954,14 +954,14 @@ yyparse () /* Close previous descriptor, if any */ if (main_jcf->read_state && fclose (main_jcf->read_state)) - fatal ("failed to close input file `%s' - yyparse", - (main_jcf->filename ? main_jcf->filename : "<unknown>")); + fatal_io_error ("can't close %s", + main_jcf->filename ? main_jcf->filename : "<unknown>"); /* Set jcf up and open a new file */ JCF_ZERO (main_jcf); main_jcf->read_state = fopen (IDENTIFIER_POINTER (name), "rb"); if (main_jcf->read_state == NULL) - pfatal_with_name (IDENTIFIER_POINTER (name)); + fatal_io_error ("can't open %s", IDENTIFIER_POINTER (name)); /* Set new input_filename and finput */ finput = main_jcf->read_state; diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 1106a75..5cb4fb3 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -1,5 +1,5 @@ /* Write out a Java(TM) class file. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -355,14 +355,15 @@ static void append_innerclasses_attribute_entry PARAMS ((struct jcf_partial *, t static int CHECK_PUT PARAMS ((void *, struct jcf_partial *, int)); static int -CHECK_PUT(ptr, state, i) +CHECK_PUT (ptr, state, i) void *ptr; struct jcf_partial *state; int i; { - if ((unsigned char *)ptr < state->chunk->data - || (unsigned char*)ptr + i > state->chunk->data + state->chunk->size) - fatal ("internal error - CHECK_PUT failed"); + if ((unsigned char *) ptr < state->chunk->data + || (unsigned char *) ptr + i > state->chunk->data + state->chunk->size) + abort (); + return 0; } #else @@ -411,16 +412,16 @@ alloc_chunk (last, data, size, work) static int CHECK_OP PARAMS ((struct jcf_partial *)); static int -CHECK_OP(struct jcf_partial *state) +CHECK_OP (state) + struct jcf_partial *state; { if (state->bytecode.ptr > state->bytecode.limit) - { - fatal("internal error - CHECK_OP failed"); - } + abort (); + return 0; } #else -#define CHECK_OP(STATE) ((void)0) +#define CHECK_OP(STATE) ((void) 0) #endif static unsigned char * @@ -687,7 +688,8 @@ get_access_flags (decl) flags |= ACC_PRIVATE; } else - fatal ("internal error - bad argument to get_access_flags"); + abort (); + if (TREE_CODE (decl) == FUNCTION_DECL) { if (METHOD_NATIVE (decl)) @@ -833,11 +835,10 @@ find_constant_index (value, state) } } else if (TREE_CODE (value) == STRING_CST) - { - return find_string_constant (&state->cpool, value); - } + return find_string_constant (&state->cpool, value); + else - fatal ("find_constant_index - bad type"); + abort (); } /* Push 64-bit long constant on VM stack. @@ -1176,12 +1177,12 @@ generate_bytecode_conditional (exp, true_label, false_label, true_label, false_label, true_branch_first, state); if (state->code_SP != save_SP_after) - fatal ("internal error non-matching SP"); + abort (); } break; case TRUTH_NOT_EXPR: - generate_bytecode_conditional (TREE_OPERAND (exp, 0), false_label, true_label, - ! true_branch_first, state); + generate_bytecode_conditional (TREE_OPERAND (exp, 0), false_label, + true_label, ! true_branch_first, state); break; case TRUTH_ANDIF_EXPR: { @@ -1345,7 +1346,7 @@ generate_bytecode_conditional (exp, true_label, false_label, break; } if (save_SP != state->code_SP) - fatal ("internal error - SP mismatch"); + abort (); } /* Call pending cleanups i.e. those for surrounding CLEANUP_POINT_EXPRs @@ -2062,12 +2063,12 @@ generate_bytecode_insns (exp, target, state) else if (TREE_CODE (exp) == ARRAY_REF) { jopcode = OPCODE_iastore + adjust_typed_op (TREE_TYPE (exp), 7); - RESERVE(1); + RESERVE (1); OP1 (jopcode); NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 4 : 3); } else - fatal ("internal error (bad lhs to MODIFY_EXPR)"); + abort (); break; case PLUS_EXPR: jopcode = OPCODE_iadd; @@ -2579,8 +2580,8 @@ generate_bytecode_insns (exp, target, state) { DECL_CONTEXT (f) = saved_context; if (nargs <= 0) - fatal ("Illegal number of arguments to invokeinterface, nargs=%d", - nargs); + abort (); + OP1 (nargs); OP1 (0); } @@ -2767,7 +2768,7 @@ perform_relocations (state) } } if (new_ptr != chunk->data) - fatal ("internal error - perform_relocations"); + abort (); } state->code_length = pc; } @@ -3288,16 +3289,11 @@ make_class_file_name (clas) if (s == NULL) break; *s = '\0'; - if (stat (r, &sb) == -1) - { + if (stat (r, &sb) == -1 /* Try to make it. */ - if (mkdir (r, 0755) == -1) - { - fatal ("failed to create directory `%s'", r); - free (r); - return NULL; - } - } + && mkdir (r, 0755) == -1) + fatal_io_error ("can't create directory %s", r); + *s = DIR_SEPARATOR; /* Skip consecutive separators. */ for (dname = s + 1; *dname && *dname == DIR_SEPARATOR; ++dname) @@ -3321,15 +3317,16 @@ write_classfile (clas) if (class_file_name != NULL) { - FILE* stream = fopen (class_file_name, "wb"); + FILE *stream = fopen (class_file_name, "wb"); if (stream == NULL) - fatal ("failed to open `%s' for writing", class_file_name); + fatal_io_error ("can't to open %s", class_file_name); + jcf_dependency_add_target (class_file_name); init_jcf_state (state, work); chunks = generate_classfile (clas, state); write_chunks (stream, chunks); if (fclose (stream)) - fatal ("failed to close after writing `%s'", class_file_name); + fatal_io_error ("can't close %s", class_file_name); free (class_file_name); } release_jcf_state (state); diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c index bb0be61..d5b0d0a 100644 --- a/gcc/java/jv-scan.c +++ b/gcc/java/jv-scan.c @@ -1,5 +1,5 @@ /* Main for jv-scan - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) This file is part of GNU CC. @@ -36,7 +36,8 @@ Boston, MA 02111-1307, USA. */ #include <getopt.h> -void fatal PARAMS ((const char *s, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; +extern void fatal_error PARAMS ((const char *s, ...)) + ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; void warning PARAMS ((const char *s, ...)) ATTRIBUTE_PRINTF_1; void gcc_obstack_init PARAMS ((struct obstack *obstack)); void report PARAMS ((void)); @@ -178,10 +179,11 @@ DEFUN (main, (argc, argv), /* Check on bad usage */ if (flag_find_main + flag_dump_class + flag_complexity > 1) - fatal ("Only one of `--print-main', `--list-class', and `--complexity' allowed"); + fatal_error + ("Only one of `--print-main', `--list-class', and `--complexity' allowed"); if (output_file && !(out = fopen (output_file, "w"))) - fatal ("Can't open output file `%s'", output_file); + fatal_error ("Can't open output file `%s'", output_file); ft = ftell (out); @@ -217,7 +219,7 @@ DEFUN (main, (argc, argv), reset_report (); } else - fatal ("File not found `%s'", argv [i]); + fatal_error ("File not found `%s'", argv [i]); } /* Flush and close */ @@ -235,7 +237,7 @@ DEFUN (main, (argc, argv), functions */ void -fatal VPARAMS ((const char *s, ...)) +fatal_error VPARAMS ((const char *s, ...)) { #ifndef ANSI_PROTOTYPES const char *s; diff --git a/gcc/java/lex.c b/gcc/java/lex.c index fdfb0a7..06eb35d 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -67,6 +67,7 @@ static int utf8_cmp PARAMS ((const unsigned char *, int, const char *)); java_lexer *java_new_lexer PARAMS ((FILE *, const char *)); +#ifdef HAVE_ICONV /* This is nonzero if we have initialized `need_byteswap'. */ static int byteswap_init = 0; @@ -75,6 +76,7 @@ static int byteswap_init = 0; doing a conversion once at startup and seeing what happens. This flag holds the results of this determination. */ static int need_byteswap = 0; +#endif void java_init_lex (finput, encoding) @@ -161,7 +163,9 @@ static void java_unget_unicode () { if (!ctxp->c_line->current) - fatal ("can't unget unicode - java_unget_unicode"); + /* Can't unget unicode. */ + abort (); + ctxp->c_line->current--; ctxp->c_line->char_col -= JAVA_COLUMN_DELTA (0); } @@ -211,6 +215,7 @@ java_allocate_new_line () } /* Create a new lexer object. */ + java_lexer * java_new_lexer (finput, encoding) FILE *finput; @@ -277,8 +282,8 @@ java_new_lexer (finput, encoding) { /* If iconv failed, use the internal decoder if the default encoding was requested. This code is used on platforms where - iconv() exists but is insufficient for our needs. For - instance, on Solaris 2.5 iconv() cannot handle UTF-8 or UCS-2. */ + iconv exists but is insufficient for our needs. For + instance, on Solaris 2.5 iconv cannot handle UTF-8 or UCS-2. */ if (strcmp (encoding, DEFAULT_ENCODING)) enc_error = 1; #ifdef HAVE_ICONV @@ -288,7 +293,7 @@ java_new_lexer (finput, encoding) } if (enc_error) - fatal ("unknown encoding: `%s'", encoding); + fatal_error ("unknown encoding: `%s'", encoding); return lex; } @@ -956,7 +961,7 @@ java_lex (java_lval) ctxp->elc.prev_col = ctxp->elc.col; ctxp->elc.col = ctxp->c_line->char_col - JAVA_COLUMN_DELTA (-1); if (ctxp->elc.col < 0) - fatal ("ctxp->elc.col < 0 - java_lex"); + abort (); /* Numeric literals */ if (JAVA_ASCII_DIGIT (c) || (c == '.')) @@ -1712,7 +1717,7 @@ java_get_line_col (filename, line, col) char *base; if (!(fp = fopen (filename, "r"))) - fatal ("Can't open file - java_display_line_col"); + fatal_io_error ("can't open %s", filename); while (cline != line) { diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c index e6ead9b5..1c83ac2 100644 --- a/gcc/java/mangle.c +++ b/gcc/java/mangle.c @@ -85,8 +85,7 @@ java_mangle_decl (obstack, decl) mangle_method_decl (decl); break; default: - fatal ("Can't mangle `%s\' -- java_mangle_decl", - tree_code_name [TREE_CODE (decl)]); + internal_error ("Can't mangle %s", tree_code_name [TREE_CODE (decl)]); } return finish_mangling (); } @@ -368,7 +367,7 @@ mangle_type (type) break; bad_type: default: - fatal ("internal error - trying to mangle unknown type"); + abort (); } } @@ -481,7 +480,7 @@ mangle_record_type (type, from_pointer) do { obstack_1grow (mangle_obstack, 'N'); nadded_p = 1; } while (0) if (TREE_CODE (type) != RECORD_TYPE) - fatal ("Non RECORD_TYPE argument -- mangle_record_type"); + abort (); if (!TYPE_PACKAGE_LIST (type)) set_type_package_list (type); @@ -534,7 +533,7 @@ mangle_pointer_type (type) pointer_type = type; type = TREE_TYPE (type); if (TREE_CODE (type) != RECORD_TYPE) - fatal ("Double indirection found -- mangle_pointer_type"); + abort (); obstack_1grow (mangle_obstack, 'P'); if (mangle_record_type (type, /* for_pointer = */ 1)) @@ -560,7 +559,8 @@ mangle_array_type (p_type) type = TREE_TYPE (p_type); if (!type) - fatal ("Non pointer array type -- mangle_array_type"); + abort (); + elt_type = TYPE_ARRAY_ELEMENT (type); /* We cache a bit of the Jarray <> mangle. */ @@ -736,7 +736,8 @@ init_mangling (obstack) if (!compression_table) compression_table = make_tree_vec (10); else - fatal ("Mangling already in progress -- init_mangling"); + /* Mangling already in progress. */ + abort (); /* Mangled name are to be suffixed */ obstack_grow (mangle_obstack, "_Z", 2); @@ -754,7 +755,8 @@ finish_mangling () tree result; if (!compression_table) - fatal ("Mangling already finished -- finish_mangling"); + /* Mangling already finished. */ + abort (); ggc_del_root (&compression_table); compression_table = NULL_TREE; diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 15e9852..dc25907 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -1,5 +1,5 @@ /* Language parser definitions for the GNU compiler for the Java(TM) language. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) This file is part of GNU CC. @@ -290,7 +290,7 @@ extern tree stabilize_reference PARAMS ((tree)); current = TREE_CHAIN (current), list = TREE_CHAIN (list)) \ ARG_FINAL_P (current) = ARG_FINAL_P (list); \ if (current != list) \ - fatal ("MARK_FINAL_PARMS"); \ + abort (); \ } /* Reset the ARG_FINAL_P that might have been set in method M args. */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index d566133..33c868c 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -2596,7 +2596,7 @@ pop_current_osb (ctxp) int to_return; if (ctxp->osb_depth < 0) - fatal ("osb stack underflow"); + abort (); to_return = CURRENT_OSB (ctxp); ctxp->osb_depth--; @@ -3167,7 +3167,7 @@ unreachable_stmt_error (node) parse_error_context (wfl_operator, "Unreachable statement"); } else - fatal ("Can't get valid statement - unreachable_stmt_error"); + abort (); } int @@ -3467,8 +3467,7 @@ make_nested_class_name (cpc_list) /* Why is NO_DOLLAR_IN_LABEL defined? */ #if 0 #ifdef NO_DOLLAR_IN_LABEL - fatal ("make_nested_class_name: Can't use '$' as a separator " - "for inner classes"); + internal_error ("Can't use '$' as a separator for inner classes"); #endif #endif obstack_1grow (&temporary_obstack, '$'); @@ -4985,7 +4984,7 @@ obtain_incomplete_type (type_name) else if (INCOMPLETE_TYPE_P (type_name)) name = TYPE_NAME (type_name); else - fatal ("invalid type name - obtain_incomplete_type"); + abort (); for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr)) if (TYPE_NAME (ptr) == name) @@ -5422,8 +5421,7 @@ java_complete_class () break; default: - fatal ("Can't handle patch code %d - java_complete_class", - JDEP_KIND (dep)); + abort (); } } } @@ -6180,7 +6178,7 @@ java_check_regular_methods (class_decl) java_check_abstract_method_definitions (class_decl); if (!saw_constructor) - fatal ("No constructor found"); + abort (); } /* Return a non zero value if the `throws' clause of METHOD (if any) @@ -7723,7 +7721,7 @@ java_complete_expand_method (mdecl) /* Pop the exceptions and sanity check */ POP_EXCEPTIONS(); if (currently_caught_type_list) - fatal ("Exception list non empty - java_complete_expand_method"); + abort (); if (flag_emit_xref) DECL_FUNCTION_THROWS (mdecl) = exception_copy; @@ -8736,7 +8734,9 @@ cut_identifier_in_qualified (wfl) if (!TREE_CHAIN (q)) { if (!previous) - fatal ("Operating on a non qualified qualified WFL - cut_identifier_in_qualified"); + /* Operating on a non qualified qualified WFL. */ + abort (); + TREE_CHAIN (previous) = NULL_TREE; return TREE_PURPOSE (q); } @@ -9580,7 +9580,7 @@ check_deprecation (wfl, decl) strcpy (the, "class"); break; default: - fatal ("unexpected DECL code - check_deprecation"); + abort (); } parse_warning_context (wfl, "The %s `%s' in class `%s' has been deprecated", @@ -10181,7 +10181,7 @@ patch_invoke (patch, method, args) break; default: - fatal ("internal error - unknown invocation_mode result"); + abort (); } /* Ensure self_type is initialized, (invokestatic). FIXME */ @@ -10426,7 +10426,7 @@ find_applicable_accessible_methods_list (lc, class, name, arglist) { lc = 1; if (!list) - fatal ("finit$ not found in class -- find_applicable_accessible_methods_list"); + abort (); } /* We must search all interfaces of this class */ @@ -11644,7 +11644,7 @@ java_complete_lhs (node) return field; } else - fatal ("unimplemented java_complete_tree for COMPONENT_REF"); + abort (); break; case THIS_EXPR: @@ -11691,8 +11691,7 @@ java_complete_lhs (node) if ((nn = patch_string (node))) node = nn; else - fatal ("No case for tree code `%s' - java_complete_tree\n", - tree_code_name [TREE_CODE (node)]); + internal_error ("No case for %s", tree_code_name [TREE_CODE (node)]); } return node; } @@ -11841,7 +11840,7 @@ lookup_name_in_blocks (name) /* Paranoid sanity check. To be removed */ if (TREE_CODE (b) != BLOCK) - fatal ("non block expr function body - lookup_name_in_blocks"); + abort (); for (current = BLOCK_EXPR_DECLS (b); current; current = TREE_CHAIN (current)) @@ -12136,7 +12135,7 @@ check_final_variable_indirect_assignment (stmt) if (TREE_CODE (decl) != FUNCTION_DECL) decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0); if (TREE_CODE (decl) != FUNCTION_DECL) - fatal ("Can't find FUNCTION_DECL in CALL_EXPR - check_final_variable_indirect_assignment"); + abort (); if (DECL_FUNCTION_ALL_FINAL_INITIALIZED (decl)) return 1; if (DECL_FINIT_P (decl) || DECL_CONTEXT (decl) != current_class) @@ -12861,8 +12860,8 @@ operator_string (node) case PREDECREMENT_EXPR: /* Fall through */ case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--"); default: - fatal ("unregistered operator %s - operator_string", - tree_code_name [TREE_CODE (node)]); + internal_error ("unregistered operator %s", + tree_code_name [TREE_CODE (node)]); } return NULL; #undef BUILD_OPERATOR_STRING @@ -13561,8 +13560,7 @@ build_unaryop (op_token, op_location, op1) case MINUS_TK: op = NEGATE_EXPR; break; case NEG_TK: op = TRUTH_NOT_EXPR; break; case NOT_TK: op = BIT_NOT_EXPR; break; - default: fatal ("Unknown token `%d' for unary operator - build_unaryop", - op_token); + default: abort (); } unaryop = build1 (op, NULL_TREE, op1); diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 83be326..e20903d 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -1,5 +1,6 @@ /* Handle types for the GNU compiler for the Java(TM) language. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -52,8 +53,10 @@ set_local_type (slot, type) { int max_locals = DECL_MAX_LOCALS(current_function_decl); int nslots = TYPE_IS_WIDE (type) ? 2 : 1; + if (slot < 0 || slot + nslots - 1 >= max_locals) - fatal ("invalid local variable index"); + abort (); + type_map[slot] = type; while (--nslots > 0) type_map[++slot] = void_type_node; @@ -498,9 +501,11 @@ parse_signature_type (ptr, limit) const unsigned char **ptr, *limit; { tree type; - if ((*ptr) >= limit) - fatal ("bad signature string"); - switch (*(*ptr)) + + if (*ptr >= limit) + abort (); + + switch (**ptr) { case 'B': (*ptr)++; return byte_type_node; case 'C': (*ptr)++; return char_type_node; @@ -523,7 +528,7 @@ parse_signature_type (ptr, limit) for ( ; ; str++) { if (str >= limit) - fatal ("bad signature string"); + abort (); if (*str == ';') break; } @@ -532,7 +537,7 @@ parse_signature_type (ptr, limit) break; } default: - fatal ("unrecognized signature string"); + abort (); } return promote_type (type); } @@ -560,7 +565,7 @@ parse_signature_string (sig_string, sig_length) argtype_list = tree_cons (NULL_TREE, argtype, argtype_list); } if (str++, str >= limit) - fatal ("bad signature string"); + abort (); result_type = parse_signature_type (&str, limit); argtype_list = chainon (nreverse (argtype_list), end_params_node); result_type = build_function_type (result_type, argtype_list); @@ -696,7 +701,7 @@ build_java_signature (type) break; bad_type: default: - fatal ("internal error - build_java_signature passed invalid type"); + abort (); } TYPE_SIGNATURE (type) = sig; } @@ -716,7 +721,7 @@ set_java_signature (type, sig) MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type); old_sig = TYPE_SIGNATURE (type); if (old_sig != NULL_TREE && old_sig != sig) - fatal ("internal error - set_java_signature"); + abort (); TYPE_SIGNATURE (type) = sig; #if 0 /* careful about METHOD_TYPE */ if (IDENTIFIER_SIGNATURE_TYPE (sig) == NULL_TREE && TREE_PERMANENT (type)) diff --git a/gcc/java/verify.c b/gcc/java/verify.c index f25fff1..5ac1d05 100644 --- a/gcc/java/verify.c +++ b/gcc/java/verify.c @@ -1,6 +1,6 @@ /* Handle verification of bytecoded methods for the GNU compiler for the Java(TM) language. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -304,9 +304,10 @@ type_stack_dup (size, offset) index++; type[index] = stack_type_map[stack_pointer - 2]; if (! TYPE_IS_WIDE (type[index])) - fatal ("internal error - dup operation"); + abort (); if (index == size || index == size + offset) - fatal ("dup operation splits 64-bit number"); + /* Dup operation splits 64-bit number. */ + abort (); } pop_type (type[index]); } @@ -393,8 +394,7 @@ pop_argument_types (arg_types) #ifdef __GNUC__ #define CHECK_PC_IN_RANGE(PC) ({if (PC < 0 || PC > length) goto bad_pc; (void)1;}) #else -#define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > length ? \ - (fatal("Bad byte codes.\n"), 0) : 1) +#define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > length ? (abort (), 0) : 1) #endif #define BCODE byte_ops diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 1cf0af9..9856f34 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1,6 +1,6 @@ /* Implement classes and message passing for Objective C. - Copyright (C) 1992, 1993, 1994, 1995, 1997, 1998, - 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Contributed by Steve Naroff. This file is part of GNU CC. @@ -730,7 +730,7 @@ objc_init () register char * const dumpname = concat (dumpname, ".decl", NULL); gen_declaration_file = fopen (dumpname, "w"); if (gen_declaration_file == 0) - pfatal_with_name (dumpname); + fatal_io_error ("can't open %s", dumpname); free (dumpname); } @@ -1088,10 +1088,7 @@ objc_check_decl (decl) if (TREE_CODE (type) == RECORD_TYPE && TREE_STATIC_TEMPLATE (type) && type != constant_string_type) - { - error_with_decl (decl, "`%s' cannot be statically allocated"); - fatal ("statically allocated objects not supported"); - } + error_with_decl (decl, "`%s' cannot be statically allocated"); } void @@ -1151,7 +1148,10 @@ get_object_reference (protocols) gen_declaration (type, errbuf)); } else - fatal ("Undefined type `id', please import <objc/objc.h>"); + { + error ("Undefined type `id', please import <objc/objc.h>"); + return error_mark_node; + } /* This clause creates a new pointer type that is qualified with the protocol specification...this info is used later to do more @@ -2585,10 +2585,8 @@ build_ivar_chain (interface, copy) } if (super_interface == interface) - { - fatal ("Circular inheritance in interface declaration for `%s'", - IDENTIFIER_POINTER (super_name)); - } + fatal_error ("Circular inheritance in interface declaration for `%s'", + IDENTIFIER_POINTER (super_name)); interface = super_interface; my_name = CLASS_NAME (interface); diff --git a/gcc/profile.c b/gcc/profile.c index 5849e7b..3cdd34b 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -904,7 +904,7 @@ init_branch_prob (filename) strip_off_ending (data_file, len); strcat (data_file, ".bb"); if ((bb_file = fopen (data_file, "wb")) == 0) - pfatal_with_name (data_file); + fatal_io_error ("can't open %s", data_file); /* Open an output file for the program flow graph. */ bbg_file_name = (char *) alloca (len + 5); @@ -912,7 +912,7 @@ init_branch_prob (filename) strip_off_ending (bbg_file_name, len); strcat (bbg_file_name, ".bbg"); if ((bbg_file = fopen (bbg_file_name, "wb")) == 0) - pfatal_with_name (bbg_file_name); + fatal_io_error ("can't open %s", bbg_file_name); /* Initialize to zero, to ensure that the first file name will be written to the .bb file. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 64b9bc3..26cc52d 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1699,10 +1699,9 @@ pop_float_handler (handled, handler) static void crash_signal (signo) - /* If this is missing, some compilers complain. */ int signo; { - fatal ("Internal error: %s.", strsignal (signo)); + internal_error ("Internal error: %s", strsignal (signo)); } /* Strip off a legitimate source ending from the input string NAME of @@ -1851,7 +1850,7 @@ open_dump_file (index, decl) rtl_dump_file = fopen (dump_name, open_arg); if (rtl_dump_file == NULL) - pfatal_with_name (dump_name); + fatal_io_error ("can't open %s", dump_name); free (dump_name); @@ -2209,7 +2208,7 @@ compile_file (name) { aux_info_file = fopen (aux_info_file_name, "w"); if (aux_info_file == 0) - pfatal_with_name (aux_info_file_name); + fatal_io_error ("can't open %s", aux_info_file_name); } /* Open assembler code output file. Do this even if -fsyntax-only is on, @@ -2234,7 +2233,7 @@ compile_file (name) else asm_out_file = fopen (asm_file_name, "w"); if (asm_out_file == 0) - pfatal_with_name (asm_file_name); + fatal_io_error ("can't open %s for writing", asm_file_name); } #ifdef IO_BUFFER_SIZE @@ -2511,8 +2510,10 @@ compile_file (name) finish_parse (); - if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0) - fatal_io_error (asm_file_name); + if (ferror (asm_out_file) != 0) + fatal_io_error ("error writing to %s", asm_file_name); + if (fclose (asm_out_file) != 0) + fatal_io_error ("error closing %s", asm_file_name); /* Do whatever is necessary to finish printing the graphs. */ if (graph_dump_format != no_graph) diff --git a/gcc/toplev.h b/gcc/toplev.h index 97134d9..093c8f8 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -1,5 +1,5 @@ /* toplev.h - Various declarations for functions found in toplev.c - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -42,21 +42,21 @@ extern void debug_end_source_file PARAMS ((unsigned)); extern void debug_define PARAMS ((unsigned, const char *)); extern void debug_undef PARAMS ((unsigned, const char *)); extern int debug_ignore_block PARAMS ((union tree_node *)); -extern void fatal PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -extern void fatal_io_error PARAMS ((const char *)) - ATTRIBUTE_NORETURN; -extern void pfatal_with_name PARAMS ((const char *)) - ATTRIBUTE_NORETURN; +extern void internal_error PARAMS ((const char *, ...)) + ATTRIBUTE_PRINTF_1 + ATTRIBUTE_NORETURN; +extern void fatal_io_error PARAMS ((const char *, ...)) + ATTRIBUTE_PRINTF_1 + ATTRIBUTE_NORETURN; extern void _fatal_insn_not_found PARAMS ((struct rtx_def *, const char *, int, const char *)) - ATTRIBUTE_NORETURN; + ATTRIBUTE_NORETURN; extern void _fatal_insn PARAMS ((const char *, struct rtx_def *, const char *, int, const char *)) - ATTRIBUTE_NORETURN; + ATTRIBUTE_NORETURN; #define fatal_insn(msgid, insn) \ _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__) @@ -64,22 +64,24 @@ extern void _fatal_insn PARAMS ((const char *, _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) extern void warning PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1; + ATTRIBUTE_PRINTF_1; extern void error PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1; + ATTRIBUTE_PRINTF_1; +extern void fatal_error PARAMS ((const char *, ...)) + ATTRIBUTE_PRINTF_1; extern void pedwarn PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1; + ATTRIBUTE_PRINTF_1; extern void pedwarn_with_file_and_line PARAMS ((const char *, int, - const char *, ...)) - ATTRIBUTE_PRINTF_3; + const char *, ...)) + ATTRIBUTE_PRINTF_3; extern void warning_with_file_and_line PARAMS ((const char *, int, - const char *, ...)) - ATTRIBUTE_PRINTF_3; + const char *, ...)) + ATTRIBUTE_PRINTF_3; extern void error_with_file_and_line PARAMS ((const char *, int, - const char *, ...)) - ATTRIBUTE_PRINTF_3; + const char *, ...)) + ATTRIBUTE_PRINTF_3; extern void sorry PARAMS ((const char *, ...)) - ATTRIBUTE_PRINTF_1; + ATTRIBUTE_PRINTF_1; extern void default_print_error_function PARAMS ((const char *)); extern void report_error_function PARAMS ((const char *)); @@ -90,20 +92,20 @@ extern void rest_of_compilation PARAMS ((union tree_node *)); /* The *_with_decl functions aren't suitable for ATTRIBUTE_PRINTF. */ extern void pedwarn_with_decl PARAMS ((union tree_node *, - const char *, ...)); + const char *, ...)); extern void warning_with_decl PARAMS ((union tree_node *, - const char *, ...)); + const char *, ...)); extern void error_with_decl PARAMS ((union tree_node *, - const char *, ...)); + const char *, ...)); extern void announce_function PARAMS ((union tree_node *)); extern void error_for_asm PARAMS ((struct rtx_def *, const char *, ...)) - ATTRIBUTE_PRINTF_2; + ATTRIBUTE_PRINTF_2; extern void warning_for_asm PARAMS ((struct rtx_def *, const char *, ...)) - ATTRIBUTE_PRINTF_2; + ATTRIBUTE_PRINTF_2; #if defined (_JBLEN) || defined (setjmp) extern void set_float_handler PARAMS ((jmp_buf)); extern int push_float_handler PARAMS ((jmp_buf, jmp_buf)); @@ -121,12 +123,13 @@ extern void botch PARAMS ((const char *)) #ifdef BUFSIZ extern void fnotice PARAMS ((FILE *, const char *, ...)) - ATTRIBUTE_PRINTF_2; + ATTRIBUTE_PRINTF_2; #endif extern int wrapup_global_declarations PARAMS ((union tree_node **, int)); extern void check_global_declarations PARAMS ((union tree_node **, int)); -extern void note_deferral_of_defined_inline_function PARAMS ((union tree_node *)); +extern void note_deferral_of_defined_inline_function + PARAMS ((union tree_node *)); extern int errorcount; extern int warningcount; extern int sorrycount; |