diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-06 04:47:42 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-06 04:47:42 +0000 |
commit | 583fa9e06b1af1cd0c6da01a9ab0ee8a1c4569ce (patch) | |
tree | 5a3ce60061200b7754e09f04fceb0b0f6076a700 /gcc/pretty-print.c | |
parent | f05fc0af2354a187ef812ad910f82ee829fcf326 (diff) | |
download | gcc-583fa9e06b1af1cd0c6da01a9ab0ee8a1c4569ce.tar.gz |
* pretty-print.c: Include tree.h.
(pp_base_prepare_to_format): New function, logic from
text_specifies_location.
(pp_base_format_text): Use gcc_assert.
* pretty-print.h (pp_prepare_to_format): New macro.
(pp_base_prepare_to_format): Prototype.
* diagnostic.c (text_specifies_location): Delete.
(bug_report_request): Delete.
(diagnostic_set_info): Don't call text_specifies_location.
(diagnostic_action_after_output): Put text from
bug_report_request inline here. Use gcc_unreachable.
(diagnostic_report_current_function): Fix comment.
(diagnostic_report_diagnostic): Clarify logic for error recursion.
Call pp_prepare_to_format before diagnostic_starter.
(trim_filename): Use IS_DIR_SEPARATOR.
(fatal_error, internal_error): Use gcc_unreachable.
(error_recursion): Call diagnostic_action_after_output to
issue the bug_report_request message and exit.
* Makefile.in (diagnostic.o, pretty-print.o): Update dependencies.
* c-parse.in: Add list of diagnostic messages to insulate
translation template from version of yacc/bison used to
compile the grammar.
java:
* parse.y, parse-scan.y: Add list of diagnostic messages to
insulate translation template from version of yacc/bison used
to compile the grammar.
treelang:
* parse.y: Add list of diagnostic messages to insulate
translation template from version of yacc/bison used to
compile the grammar.
po:
* gcc.pot: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/pretty-print.c')
-rw-r--r-- | gcc/pretty-print.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index d6098a74745..b2e0ee439be 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -26,6 +26,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "coretypes.h" #include "intl.h" #include "pretty-print.h" +#include "tree.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -165,6 +166,40 @@ pp_base_indent (pretty_printer *pp) pp_space (pp); } +/* Prepare PP to format a message pointed to by TEXT, with tentative + location LOCUS. It is expected that a call to pp_format_text with + exactly the same PP and TEXT arguments will follow. This routine + may modify the data in memory at TEXT and LOCP, and if it does, + caller is expected to notice. + + Currently, all this does is notice a %H or %J escape at the beginning + of the string, and update LOCUS to match. */ +void +pp_base_prepare_to_format (pretty_printer *pp ATTRIBUTE_UNUSED, + text_info *text, + location_t *locus) +{ + const char *p = text->format_spec; + tree t; + + /* Extract the location information if any. */ + if (p[0] == '%') + switch (p[1]) + { + case 'H': + *locus = *va_arg (*text->args_ptr, location_t *); + text->format_spec = p + 2; + break; + + case 'J': + t = va_arg (*text->args_ptr, tree); + *locus = DECL_SOURCE_LOCATION (t); + text->format_spec = p + 2; + break; + } +} + + /* Format a message pointed to by TEXT. The following format specifiers are recognized as being client independent: %d, %i: (signed) integer in base ten. @@ -231,8 +266,7 @@ pp_base_format_text (pretty_printer *pp, text_info *text) break; } /* We don't support precision beyond that of "long long". */ - if (precision > 2) - abort(); + gcc_assert (precision <= 2); if (quoted) pp_string (pp, open_quote); @@ -319,10 +353,11 @@ pp_base_format_text (pretty_printer *pp, text_info *text) int n; const char *s; /* We handle no precision specifier but '%.*s'. */ - if (*++text->format_spec != '*') - abort (); - else if (*++text->format_spec != 's') - abort (); + ++text->format_spec; + gcc_assert (*text->format_spec == '*'); + ++text->format_spec; + gcc_assert (*text->format_spec == 's'); + n = va_arg (*text->args_ptr, int); s = va_arg (*text->args_ptr, const char *); pp_append_text (pp, s, s + n); |