aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2005-06-30 23:09:06 +0000
committerZack Weinberg <zack@gcc.gnu.org>2005-06-30 23:09:06 +0000
commit39ce81c9c560d14c746714e6ec1621cad38bae93 (patch)
treeaaf251a28f0a2167060005edc8eb763baadddd63 /gcc/cp/error.c
parenta3648cfc0c331051ae47bedcc40c561f9979673a (diff)
downloadgcc-39ce81c9c560d14c746714e6ec1621cad38bae93.zip
gcc-39ce81c9c560d14c746714e6ec1621cad38bae93.tar.gz
gcc-39ce81c9c560d14c746714e6ec1621cad38bae93.tar.bz2
pretty-print.h (PP_NL_ARGMAX): New.
gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 6fe9c74..fd222be 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -86,7 +86,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 (pretty_printer *, text_info *);
+static bool cp_printer (pretty_printer *, text_info *, const char *,
+ int, bool, bool, bool);
static tree locate_error (const char *, va_list);
static location_t location_of (tree);
@@ -2228,8 +2229,9 @@ print_instantiation_partial_context (diagnostic_context *context,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
loc = TINST_LOCATION (t);
}
- pp_verbatim (context->printer, "%s:%d: instantiated from here\n",
+ pp_verbatim (context->printer, "%s:%d: instantiated from here",
xloc.file, xloc.line);
+ pp_base_newline (context->printer);
}
/* Called from cp_thing to print the template context for an error. */
@@ -2266,24 +2268,23 @@ print_instantiation_context (void)
%T type.
%V cv-qualifier. */
static bool
-cp_printer (pretty_printer *pp, text_info *text)
+cp_printer (pretty_printer *pp, text_info *text, const char *spec,
+ int precision, bool wide, bool set_locus, bool verbose)
{
- int verbose = 0;
const char *result;
-#define next_tree va_arg (*text->args_ptr, tree)
+ tree t = NULL;
+#define next_tree (t = va_arg (*text->args_ptr, tree))
#define next_tcode va_arg (*text->args_ptr, enum tree_code)
#define next_lang va_arg (*text->args_ptr, enum languages)
#define next_int va_arg (*text->args_ptr, int)
- if (*text->format_spec == '+')
- ++text->format_spec;
- if (*text->format_spec == '#')
- {
- verbose = 1;
- ++text->format_spec;
- }
+ if (precision != 0 || wide)
+ return false;
+
+ if (text->locus == NULL)
+ set_locus = false;
- switch (*text->format_spec)
+ switch (*spec)
{
case 'A': result = args_to_string (next_tree, verbose); break;
case 'C': result = code_to_string (next_tcode); break;
@@ -2302,6 +2303,8 @@ cp_printer (pretty_printer *pp, text_info *text)
}
pp_base_string (pp, result);
+ if (set_locus && t != NULL)
+ *text->locus = location_of (t);
return true;
#undef next_tree
#undef next_tcode