From: Gabriel Dos Reis Date: Fri, 25 Jul 2003 09:52:32 +0000 (+0000) Subject: Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6fe0bb8c5a68ed64a124734c3fdc39777f8f7e6;p=gcc.git Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a68dfba090..5c90a76b371 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,75 @@ +2003-07-25 Gabriel Dos Reis + + Remove pedwarn_with_decl, warning_with_decl and error_with_decl + from GCC. + * calls.c (try_to_integrate): Don't use xxx_with_decl. + (expand_call): Likewise. + * dwarfout.c (output_reg_number): Likewise. + * expr.c (expand_expr): Likewise. + * function.c (assign_temp): Likewise. + (uninitialized_vars_warning): Likewise. + (setjmp_args_warning): Likewise. + (expand_function_end): Likewise. + * stmt.c (fixup_gotos): Likewise. + (warn_about_unused_variables): Likewise. + (expand_end_bindings): Likewise. + * stor-layout.c (layout_decl): Likewise. + (place_field): Likewise. + * toplev.c (check_global_declarations): Likewise. + (rest_of_handle_inlining): Likewise. + (default_tree_printer): New function. + (general_init): Initialize diagnostic machinery before routing + signals to the ICE machinery. Set default tree printer. + * toplev.h (pedwarn_with_decl): Remove declaration. + (warning_with_decl): Likewise. + (error_with_decl): Likewise. + (pedwarn): Remove attribute for the time being. + * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. + * varasm.c (named_section): Likewise. + (make_decl_rtl): Likewise. + (assemble_variable): Likewise. + (merge_weak): Likewise. + (declare_weak): Likewise. + + * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. + * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. + (format_with_decl): Remove. + (diagnostic_for_decl): Likewise. + (pedwarn_with_decl): Likewise. + (warning_with_decl): Likewise. + (error_with_decl): Likewise. + (diagnostic_initialize): Adjust. + (diagnostic_count_diagnostic): Likewise. + (announce_function): Likewise. + (lhd_print_error_function): Likewise. + (diagnostic_report_current_module): Likewise. + (default_diagnostic_starter): Likewise. + (diagnostic_report_diagnostic): Likewise. + (default_diagnostic_finalizer): Likewise. + (verbatim): Likewise. + (error): Likewise. + (warning): Likewise. + * opts.c (common_handle_option): Likewise. + * pretty-print.c: New file. + * c-pretty-print.h (pp_base): Override. + * c-pretty-print.c: Adjust use of macros throughout. + (pp_buffer): New macro. + (pp_newline): Likewise. + * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. + * Makefile.in (DIAGNOSTIC_H): New variable. + (c-errors.o): Use it. + (c-objc-common.o): Likewise. + (c-common.o): Likewise. + (c-opts.o): Likewise. + (c-format.o): Likewise. + (diagnostic.o): Likewise. + (opts.o): Likewise. + (toplev.o): Likewise. + (rtl-error.o): Likewise. + (dwarf2out.o): Likewise. + (jump.o): Likewise. + (pretty-print.o): New rule. + 2003-07-24 Roger Sayle * builtins.def (BUILT_IN_PRINTF, BUILT_IN_FPRINTF): Changed from diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 41e90fbc215..1968f82776b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -652,6 +652,8 @@ C_TREE_H = c-tree.h $(C_COMMON_H) SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h PREDICT_H = predict.h predict.def CPPLIB_H = cpplib.h line-map.h +PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H) +DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H) # sed inserts variable overrides after the following line. ####target overrides @@ -821,7 +823,7 @@ OBJS-common = \ sibcall.o simplify-rtx.o sreal.o ssa.o ssa-ccp.o ssa-dce.o stmt.o \ stor-layout.o stringpool.o timevar.o toplev.o tracer.o tree.o tree-dump.o \ unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o \ - alloc-pool.o et-forest.o cfghooks.o bt-load.o $(GGC) + alloc-pool.o et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) OBJS-md = $(out_object_file) OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) hashtable.o tree-inline.o \ @@ -1238,7 +1240,7 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H) # C language specific files. c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - $(C_TREE_H) flags.h diagnostic.h $(TM_P_H) + $(C_TREE_H) flags.h $(DIAGNOSTIC_H) $(TM_P_H) c-parse.o : $(parsedir)/c-parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(GGC_H) intl.h $(C_TREE_H) input.h flags.h toplev.h output.h $(CPPLIB_H) \ varray.h gt-c-parse.h @@ -1282,7 +1284,7 @@ c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) cpphash.h $(TM_P_H) c-pragma.h c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) $(C_TREE_H) \ - flags.h toplev.h tree-inline.h diagnostic.h $(VARRAY_H) \ + flags.h toplev.h tree-inline.h $(DIAGNOSTIC_H) $(VARRAY_H) \ langhooks.h $(GGC_H) gt-c-objc-common.h $(TARGET_H) cgraph.h c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) flags.h toplev.h @@ -1317,13 +1319,13 @@ tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(OBSTACK_H) $(C_COMMON_H) flags.h toplev.h output.h c-pragma.h intl.h \ $(GGC_H) $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def \ - diagnostic.h gt-c-common.h langhooks.h varray.h $(RTL_H) $(TARGET_H) \ - $(C_TREE_H) + $(DIAGNOSTIC_H) gt-c-common.h langhooks.h varray.h $(RTL_H) \ + $(TARGET_H) $(C_TREE_H) c-pretty-print.o : c-pretty-print.c c-pretty-print.h pretty-print.h \ $(C_COMMON_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) real.h c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - c-pragma.h flags.h toplev.h langhooks.h tree-inline.h diagnostic.h \ + c-pragma.h flags.h toplev.h langhooks.h tree-inline.h $(DIAGNOSTIC_H) \ intl.h debug.h $(C_COMMON_H) opts.h options.h $(PARAMS_H) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@ @@ -1339,7 +1341,7 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) flag builtin-types.def $(TARGET_H) langhooks.h c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \ - $(C_COMMON_H) flags.h toplev.h intl.h diagnostic.h + $(C_COMMON_H) flags.h toplev.h intl.h $(DIAGNOSTIC_H) c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ @@ -1473,14 +1475,14 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE langhooks.h fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ flags.h real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h -diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \ +diagnostic.o : diagnostic.c $(DIAGNOSTIC_H) real.h \ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \ input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H) opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H) $(GGC_H) $(RTL_H) \ - output.h diagnostic.h $(TM_P_H) $(INSN_ATTR_H) intl.h + output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ - function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \ + function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) \ debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \ dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \ graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) \ @@ -1496,7 +1498,7 @@ host-default.o : host-default.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ hosthooks.h hosthooks-def.h rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(INSN_ATTR_H) \ - insn-config.h input.h toplev.h intl.h diagnostic.h $(CONFIG_H) + insn-config.h input.h toplev.h intl.h $(DIAGNOSTIC_H) $(CONFIG_H) rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(RTL_H) real.h \ $(GGC_H) errors.h @@ -1563,7 +1565,7 @@ dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) dwarf.h flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \ debug.h langhooks.h $(TARGET_H) dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ - $(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h diagnostic.h real.h \ + $(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h $(DIAGNOSTIC_H) real.h \ hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \ $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) \ gt-dwarf2out.h $(TARGET_H) @@ -1585,7 +1587,7 @@ integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $ jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \ toplev.h $(INSN_ATTR_H) $(TM_P_H) reload.h $(PREDICT_H) $(TIMEVAR_H) \ - diagnostic.h + $(DIAGNOSTIC_H) simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(REGS_H) hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ @@ -1794,6 +1796,7 @@ ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ cfgloop.h params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H) +pretty-print.o: pretty-print.c $(PRETTY_PRINT_H) $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) $(GGC_H) \ $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \ diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 0d44e1d883b..887175be6f8 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -39,7 +39,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "target.h" #include "cgraph.h" -static bool c_tree_printer (output_buffer *, text_info *); +static bool c_tree_printer (pretty_printer *, text_info *); static tree inline_forbidden_p (tree *, int *, void *); static void expand_deferred_fns (void); static tree start_cdtor (int); @@ -416,7 +416,7 @@ c_objc_common_finish_file (void) Please notice when called, the `%' part was already skipped by the diagnostic machinery. */ static bool -c_tree_printer (output_buffer *buffer, text_info *text) +c_tree_printer (pretty_printer *pp, text_info *text) { tree t = va_arg (*text->args_ptr, tree); @@ -429,14 +429,14 @@ c_tree_printer (output_buffer *buffer, text_info *text) const char *n = DECL_NAME (t) ? (*lang_hooks.decl_printable_name) (t, 2) : "({anonymous})"; - output_add_string (buffer, n); + pp_string (pp, n); } return true; case 'E': if (TREE_CODE (t) == IDENTIFIER_NODE) { - output_add_string (buffer, IDENTIFIER_POINTER (t)); + pp_string (pp, IDENTIFIER_POINTER (t)); return true; } return false; diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 63b18b3ad13..7bb4cb03ed8 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -74,6 +74,9 @@ static void pp_c_type_id (c_pretty_printer, tree); static void pp_c_storage_class_specifier (c_pretty_printer, tree); static void pp_c_function_specifier (c_pretty_printer, tree); +#define pp_buffer(PP) pp_base (PP)->buffer +#define pp_newline(PP) (pp_newline) (pp_base (PP)) + /* Declarations. */ @@ -248,9 +251,9 @@ pp_c_init_declarator (c_pretty_printer pp, tree t) pp_declarator (pp, t); if (DECL_INITIAL (t)) { - pp_whitespace (pp); + pp_space (pp); pp_equal (pp); - pp_whitespace (pp); + pp_space (pp); pp_c_initializer (pp, DECL_INITIAL (t)); } } @@ -336,9 +339,9 @@ pp_c_char (c_pretty_printer ppi, int c) break; default: if (ISPRINT (c)) - pp_character (ppi, c); + pp_character (&ppi->base, c); else - pp_format_scalar (ppi, "\\%03o", (unsigned) c); + pp_scalar (ppi, "\\%03o", (unsigned) c); break; } } @@ -1038,7 +1041,7 @@ pp_c_assignment_expression (c_pretty_printer ppi, tree e) pp_c_unary_expression (ppi, TREE_OPERAND (e, 0)); pp_c_maybe_whitespace (ppi); pp_equal (ppi); - pp_whitespace (ppi); + pp_space (ppi); pp_c_assignment_expression (ppi, TREE_OPERAND (e, 1)); } else @@ -1234,7 +1237,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) case IF_STMT: pp_c_identifier (ppi, "if"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_c_expression (ppi, IF_COND (stmt)); pp_right_paren (ppi); @@ -1258,7 +1261,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) case SWITCH_STMT: pp_newline (ppi); pp_c_identifier (ppi, "switch"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_c_expression (ppi, SWITCH_COND (stmt)); pp_right_paren (ppi); @@ -1269,7 +1272,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) case WHILE_STMT: pp_c_identifier (ppi, "while"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_c_expression (ppi, WHILE_COND (stmt)); pp_right_paren (ppi); @@ -1284,7 +1287,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) pp_statement (ppi, DO_BODY (stmt)); pp_newline_and_indent (ppi, -3); pp_c_identifier (ppi, "while"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_c_expression (ppi, DO_COND (stmt)); pp_c_right_paren (ppi); @@ -1294,7 +1297,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) case FOR_STMT: pp_c_identifier (ppi, "for"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_statement (ppi, FOR_INIT_STMT (stmt)); pp_c_whitespace (ppi); @@ -1364,20 +1367,20 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) pp_c_identifier (ppi, is_extended ? "__asm__" : "asm"); if (has_volatile_p) pp_c_identifier (ppi, "__volatile__"); - pp_whitespace (ppi); + pp_space (ppi); pp_c_left_paren (ppi); pp_c_string_literal (ppi, ASM_STRING (stmt)); if (is_extended) { - pp_whitespace (ppi); + pp_space (ppi); pp_separate_with (ppi, ':'); if (ASM_OUTPUTS (stmt)) pp_c_expression (ppi, ASM_OUTPUTS (stmt)); - pp_whitespace (ppi); + pp_space (ppi); pp_separate_with (ppi, ':'); if (ASM_INPUTS (stmt)) pp_c_expression (ppi, ASM_INPUTS (stmt)); - pp_whitespace (ppi); + pp_space (ppi); pp_separate_with (ppi, ':'); if (ASM_CLOBBERS (stmt)) pp_c_expression (ppi, ASM_CLOBBERS (stmt)); @@ -1389,7 +1392,7 @@ pp_c_statement (c_pretty_printer ppi, tree stmt) case FILE_STMT: pp_c_identifier (ppi, "__FILE__"); - pp_whitespace (ppi); + pp_space (ppi); pp_equal (ppi); pp_c_whitespace (ppi); pp_c_identifier (ppi, FILE_STMT_FILENAME (stmt)); diff --git a/gcc/c-pretty-print.h b/gcc/c-pretty-print.h index 95cd4eff198..bdd92b15f1b 100644 --- a/gcc/c-pretty-print.h +++ b/gcc/c-pretty-print.h @@ -62,6 +62,9 @@ struct c_pretty_print_info c_pretty_print_fn assignment_expression; }; +#undef pp_base +#define pp_base(PP) (&pp_c_base (PP)->base) + #define pp_c_left_paren(PPI) \ do { \ pp_left_paren (PPI); \ @@ -84,7 +87,7 @@ struct c_pretty_print_info } while (0) #define pp_c_whitespace(PPI) \ do { \ - pp_whitespace (PPI); \ + pp_space (PPI); \ pp_c_base (PPI)->base.padding = pp_none; \ } while (0) #define pp_c_maybe_whitespace(PPI) \ @@ -102,10 +105,6 @@ struct c_pretty_print_info #define pp_c_tree_identifier(PPI, ID) \ pp_c_identifier (PPI, IDENTIFIER_POINTER (ID)) -/* Returns the 'output_buffer *' associated with a PRETTY-PRINTER, the latter - being something digestible by pp_c_base. */ -#define pp_buffer(PPI) pp_c_base (PPI)->base.buffer - #define pp_declaration(PPI, T) \ (*pp_c_base (PPI)->declaration) (pp_c_base (PPI), T) #define pp_declaration_specifiers(PPI, D) \ diff --git a/gcc/calls.c b/gcc/calls.c index 7add542656f..135b3336e31 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1808,7 +1808,8 @@ try_to_integrate (tree fndecl, tree actparms, rtx target, int ignore, if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline && optimize > 0 && !TREE_ADDRESSABLE (fndecl)) { - warning_with_decl (fndecl, "inlining failed in call to `%s'"); + warning ("%Hinlining failed in call to '%F'", + &DECL_SOURCE_LOCATION (fndecl), fndecl); warning ("called from here"); } (*lang_hooks.mark_addressable) (fndecl); @@ -2147,7 +2148,8 @@ expand_call (tree exp, rtx target, int ignore) if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline && optimize > 0) { - warning_with_decl (fndecl, "can't inline call to `%s'"); + warning ("%Hcan't inline call to '%F'", + &DECL_SOURCE_LOCATION (fndecl), fndecl); warning ("called from here"); } (*lang_hooks.mark_addressable) (fndecl); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7abf46ba693..0487cbae8e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-07-25 Gabriel Dos Reis + + * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. + * error.c: Use the new pretty-printer fraamework. + 2003-07-24 Per Bothner * decl.c (pushdecl_class_level): Don't use push_srcloc/pop_srcloc diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index df1d8a79216..d16a5bcb02e 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -265,8 +265,8 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ except.h $(TM_P_H) cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \ toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h -cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h flags.h real.h \ - $(LANGHOOKS_DEF_H) +cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \ + flags.h real.h $(LANGHOOKS_DEF_H) cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \ gt-cp-repo.h cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 11a548bd1fe..86b336e3c4d 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -30,32 +30,21 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "diagnostic.h" #include "langhooks-def.h" +#include "pretty-print.h" enum pad { none, before, after }; -#define sorry_for_unsupported_tree(T) \ - sorry ("`%s' not supported by %s", tree_code_name[(int) TREE_CODE (T)], \ - __FUNCTION__) - -#define print_scope_operator(BUFFER) output_add_string ((BUFFER), "::") -#define print_left_paren(BUFFER) output_add_character ((BUFFER), '(') -#define print_right_paren(BUFFER) output_add_character ((BUFFER), ')') -#define print_left_bracket(BUFFER) output_add_character ((BUFFER), '[') -#define print_right_bracket(BUFFER) output_add_character ((BUFFER), ']') -#define print_template_argument_list_start(BUFFER) \ - print_non_consecutive_character ((BUFFER), '<') -#define print_template_argument_list_end(BUFFER) \ - print_non_consecutive_character ((BUFFER), '>') -#define print_tree_identifier(BUFFER, TID) \ - output_add_string ((BUFFER), IDENTIFIER_POINTER (TID)) -#define print_identifier(BUFFER, ID) output_add_string ((BUFFER), (ID)) -#define separate_with_comma(BUFFER) output_add_string ((BUFFER), ", ") +#define pp_template_argument_list_start(PP) \ + pp_non_consecutive_character (PP, '<') +#define pp_template_argument_list_end(PP) \ + pp_non_consecutive_character (PP, '>') +#define pp_separate_with_comma(PP) pp_string (PP, ", ") /* The global buffer where we dump everything. It is there only for transitional purpose. It is expected, in the near future, to be completely removed. */ -static output_buffer scratch_buffer_rec; -static output_buffer *scratch_buffer = &scratch_buffer_rec; +static pretty_printer scratch_pretty_printer; +#define cxx_pp (&scratch_pretty_printer) # define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T))) @@ -109,8 +98,8 @@ static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *); static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *); static void cp_print_error_function (diagnostic_context *, diagnostic_info *); -static bool cp_printer (output_buffer *, text_info *); -static void print_non_consecutive_character (output_buffer *, int); +static bool cp_printer (pretty_printer *, text_info *); +static void pp_non_consecutive_character (pretty_printer *, int); static tree locate_error (const char *, va_list); static location_t location_of (tree); @@ -121,7 +110,7 @@ init_error (void) diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer; diagnostic_format_decoder (global_dc) = cp_printer; - init_output_buffer (scratch_buffer, /* prefix */NULL, /* line-width */0); + pp_construct (cxx_pp, NULL, 0); } /* Dump a scope, if deemed necessary. */ @@ -139,18 +128,18 @@ dump_scope (tree scope, int flags) if (scope != global_namespace) { dump_decl (scope, f); - print_scope_operator (scratch_buffer); + pp_colon_colon (cxx_pp); } } else if (AGGREGATE_TYPE_P (scope)) { dump_type (scope, f); - print_scope_operator (scratch_buffer); + pp_colon_colon (cxx_pp); } else if ((flags & TFF_SCOPE) && TREE_CODE (scope) == FUNCTION_DECL) { dump_function_decl (scope, f); - print_scope_operator (scratch_buffer); + pp_colon_colon (cxx_pp); } } @@ -174,12 +163,12 @@ dump_qualifiers (tree t, enum pad p) if (masks[ix] & quals) { if (p == before) - output_add_space (scratch_buffer); + pp_space (cxx_pp); p = before; - print_identifier (scratch_buffer, names[ix]); + pp_identifier (cxx_pp, names[ix]); } if (do_after) - output_add_space (scratch_buffer); + pp_space (cxx_pp); } else p = none; @@ -210,7 +199,7 @@ dump_template_argument_list (tree args, int flags) for (i = 0; i< n; ++i) { if (need_comma) - separate_with_comma (scratch_buffer); + pp_separate_with_comma (cxx_pp); dump_template_argument (TREE_VEC_ELT (args, i), flags); need_comma = 1; } @@ -228,24 +217,24 @@ dump_template_parameter (tree parm, int flags) { if (flags & TFF_DECL_SPECIFIERS) { - print_identifier (scratch_buffer, "class"); + pp_identifier (cxx_pp, "class"); if (DECL_NAME (p)) { - output_add_space (scratch_buffer); - print_tree_identifier (scratch_buffer, DECL_NAME (p)); + pp_space (cxx_pp); + pp_tree_identifier (cxx_pp, DECL_NAME (p)); } } else if (DECL_NAME (p)) - print_tree_identifier (scratch_buffer, DECL_NAME (p)); + pp_tree_identifier (cxx_pp, DECL_NAME (p)); else - print_identifier (scratch_buffer, "{template default argument error}"); + pp_identifier (cxx_pp, "