From 4322eb6c0ee5bac01fbca9846438084d33367120 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 4 Feb 2001 23:18:43 +0000 Subject: [PATCH] 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: r39444 --- gcc/ch/ChangeLog | 12 ++++++++++++ gcc/ch/convert.c | 9 +++++---- gcc/ch/except.c | 7 ++++--- gcc/ch/expr.c | 17 +++++++++-------- gcc/ch/grant.c | 9 +++++---- gcc/ch/lang.c | 14 +------------- gcc/ch/lex.c | 21 +++++++++++---------- gcc/ch/parse.c | 17 +++++++++-------- 8 files changed, 56 insertions(+), 50 deletions(-) diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index c3f6809a376..8356aa22a4a 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,15 @@ +Sun Feb 4 15:52:44 2001 Richard Kenner + + * convert.c (convert): Call abort instead of fatal. + * except.c (pop_handler, chill_check_no_handlers): Likewise. + * expr.c (chill_expand_expr): Likewise. + * parse.c (peek_token_, pushback_token, require): Likewise. + * grant.c (write_grant_file): Call fatal_io_error instead of + pfatal_with_name. + * lex.c (init_parse, same_file, yywrap): Likewise. + * lang.c (GNU_xref_begin, GNU_xref_end): Deleted. + * lex.c (convert_bitstring): Delete check for alloca failure. + 2001-01-28 Kaveh R. Ghazi * ch-tree.h (integer_minus_one_node): Moved to top level gcc diff --git a/gcc/ch/convert.c b/gcc/ch/convert.c index dcea057f500..e7c93109bd0 100644 --- a/gcc/ch/convert.c +++ b/gcc/ch/convert.c @@ -1,5 +1,5 @@ /* Language-level data type conversion for GNU CHILL. - Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -1135,11 +1135,12 @@ convert (type, expr) { if (TREE_CODE (type) == SET_TYPE) return digest_powerset_tuple (type, e); - if (TREE_CODE (type) == RECORD_TYPE) + else if (TREE_CODE (type) == RECORD_TYPE) return digest_structure_tuple (type, e); - if (TREE_CODE (type) == ARRAY_TYPE) + else if (TREE_CODE (type) == ARRAY_TYPE) return digest_array_tuple (type, e, 0); - fatal ("internal error - bad CONSTRUCTOR passed to convert"); + else + abort (); } else if (TREE_CODE (e) == COND_EXPR) e = build (COND_EXPR, type, diff --git a/gcc/ch/except.c b/gcc/ch/except.c index c1b85dffea6..b32dba60636 100644 --- a/gcc/ch/except.c +++ b/gcc/ch/except.c @@ -1,6 +1,6 @@ /* Exception support for GNU CHILL. WARNING: Only works for native (needs setjmp.h)! FIXME! - Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -361,8 +361,9 @@ pop_handler (used) if (pass == 1) { struct handler_state *old = current_handler; + if (old == NULL) - fatal ("internal error: on stack out of sync"); + abort (); current_handler = old->next; if (used) @@ -539,7 +540,7 @@ void chill_check_no_handlers () { if (current_handler != NULL) - fatal ("internal error: on stack not empty when done"); + abort (); } static void diff --git a/gcc/ch/expr.c b/gcc/ch/expr.c index 40f74a42af0..59371e820db 100644 --- a/gcc/ch/expr.c +++ b/gcc/ch/expr.c @@ -1,6 +1,6 @@ /* Convert language-specific tree expression to rtl instructions, for GNU CHILL compiler. - Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -390,19 +390,20 @@ chill_expand_expr (exp, target, tmode, modifier) { tree type0 = TREE_TYPE (exp0); tree type1 = TREE_TYPE (exp1); - int len0 = int_size_in_bytes (type0); - int len1 = int_size_in_bytes (type1); + HOST_WIDE_INT len0 = int_size_in_bytes (type0); + HOST_WIDE_INT len1 = int_size_in_bytes (type1); if (len0 < 0 && TYPE_ARRAY_MAX_SIZE (type0) - && TREE_CODE (TYPE_ARRAY_MAX_SIZE (type0)) == INTEGER_CST) - len0 = TREE_INT_CST_LOW (TYPE_ARRAY_MAX_SIZE (type0)); + && host_integerp (TYPE_ARRAY_MAX_SIZE (type0), 1)) + len0 = tree_low_cst (TYPE_ARRAY_MAX_SIZE (type0), 1); if (len1 < 0 && TYPE_ARRAY_MAX_SIZE (type1) - && TREE_CODE (TYPE_ARRAY_MAX_SIZE (type1)) == INTEGER_CST) - len1 = TREE_INT_CST_LOW (TYPE_ARRAY_MAX_SIZE (type1)); + && host_integerp (TYPE_ARRAY_MAX_SIZE (type1), 1)) + len1 = tree_low_cst (TYPE_ARRAY_MAX_SIZE (type1), 1); if (len0 < 0 || len1 < 0) - fatal ("internal error - don't know how much space is needed for concatenation"); + abort (); + target = assign_stack_temp (mode, len0 + len1, 0); preserve_temp_slots (target); } diff --git a/gcc/ch/grant.c b/gcc/ch/grant.c index 42328c122a8..29e7ddc1bb5 100644 --- a/gcc/ch/grant.c +++ b/gcc/ch/grant.c @@ -1,6 +1,6 @@ /* Implement grant-file output & seize-file input for CHILL. - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, - 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -2648,7 +2648,7 @@ write_grant_file () fb = fopen (grant_file_name, "w"); if (fb == NULL) - pfatal_with_name (grant_file_name); + fatal_io_error ("can't open %s", grant_file_name); /* write file. Due to problems with record sizes on VAX/VMS write string to '\n' */ @@ -2670,9 +2670,10 @@ write_grant_file () if (write (fileno (fb), gstring->str, gstring->len) < 0) { int save_errno = errno; + unlink (grant_file_name); errno = save_errno; - pfatal_with_name (grant_file_name); + fatal_io_error ("can't write to %s", grant_file_name); } #endif fclose (fb); diff --git a/gcc/ch/lang.c b/gcc/ch/lang.c index fbb646bca51..0c493b70bfe 100644 --- a/gcc/ch/lang.c +++ b/gcc/ch/lang.c @@ -1,5 +1,5 @@ /* Language-specific hook definitions for CHILL front end. - Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -148,18 +148,6 @@ lang_print_xnode (file, node, indent) int indent ATTRIBUTE_UNUSED; { } - -void -GNU_xref_begin () -{ - fatal ("GCC does not yet support XREF"); -} - -void -GNU_xref_end () -{ - fatal ("GCC does not yet support XREF"); -} /* * process chill-specific compiler command-line options diff --git a/gcc/ch/lex.c b/gcc/ch/lex.c index f747bef570a..1a87025baae 100644 --- a/gcc/ch/lex.c +++ b/gcc/ch/lex.c @@ -1,5 +1,5 @@ /* Lexical analyzer for GNU CHILL. -*- C -*- - Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -212,8 +212,9 @@ 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); @@ -1288,7 +1289,6 @@ convert_bitstring (p) /* Move p to stack so we can re-use temporary_obstack for result. */ char *oldp = (char*) alloca (strlen (p) + 1); - if (oldp == 0) fatal ("stack space exhausted"); strcpy (oldp, p); obstack_free (&temporary_obstack, p); p = oldp; @@ -1378,16 +1378,16 @@ same_file (filename1, filename2) for (i = 0; i < 2; i++) { stat_status = stat (fn_input[i], &s[i]); - if (stat_status < 0 && - strchr (fn_input[i], '/') == 0) + if (stat_status < 0 + && strchr (fn_input[i], '/') == 0) { STRING_LIST *plp; - char *path; + char *path; for (plp = seize_path_list; plp != 0; plp = plp->next) { - path = (char *)xmalloc (strlen (fn_input[i]) + - strlen (plp->str) + 2); + path = (char *) xmalloc (strlen (fn_input[i]) + + strlen (plp->str) + 2); sprintf (path, "%s/%s", plp->str, fn_input[i]); stat_status = stat (path, &s[i]); free (path); @@ -1395,8 +1395,9 @@ same_file (filename1, filename2) break; } } + if (stat_status < 0) - pfatal_with_name (fn_input[i]); + fatal_io_error ("can't find %s", fn_input[i]); } return s[0].st_ino == s[1].st_ino && s[0].st_dev == s[1].st_dev; } @@ -2190,7 +2191,7 @@ yywrap () } if (grt_in == NULL) - pfatal_with_name (seizefile_name_chars); + fatal_io_error ("can't open %s", seizefile_name_chars); finput = grt_in; input_filename = seizefile_name_chars; diff --git a/gcc/ch/parse.c b/gcc/ch/parse.c index 74e10c20174..afcf1427fd8 100644 --- a/gcc/ch/parse.c +++ b/gcc/ch/parse.c @@ -1,5 +1,5 @@ /* Parser for GNU CHILL (CCITT High-Level Language) -*- C -*- - Copyright (C) 1992, 1993, 1998, 1999, 2000 + Copyright (C) 1992, 1993, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -278,14 +278,15 @@ PEEK_TOKEN() return terminal_buffer[0]; } #define PEEK_TREE() val_buffer[0].ttype -#define PEEK_TOKEN1() peek_token_(1) -#define PEEK_TOKEN2() peek_token_(2) +#define PEEK_TOKEN1() peek_token_ (1) +#define PEEK_TOKEN2() peek_token_ (2) + static int peek_token_ (i) int i; { if (i > MAX_LOOK_AHEAD) - fatal ("internal error - too much lookahead"); + abort (); if (terminal_buffer[i] == TOKEN_NOT_READ) { terminal_buffer[i] = yylex(); @@ -301,7 +302,7 @@ pushback_token (code, node) { int i; if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ) - fatal ("internal error - cannot pushback token"); + abort (); for (i = MAX_LOOK_AHEAD; i > 0; i--) { terminal_buffer[i] = terminal_buffer[i - 1]; @@ -322,17 +323,17 @@ forward_token_() } terminal_buffer[MAX_LOOK_AHEAD] = TOKEN_NOT_READ; } -#define FORWARD_TOKEN() forward_token_() +#define FORWARD_TOKEN() forward_token_ () /* Skip the next token. if it isn't TOKEN, the parser is broken. */ static void -require(token) +require (token) enum terminal token; { if (PEEK_TOKEN() != token) - fatal ("internal parser error - expected token %d", (int)token); + internal_error ("internal parser error - expected token %d", (int) token); FORWARD_TOKEN(); } -- 2.30.2