diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-20 14:57:16 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-20 14:57:16 +0000 |
commit | 91b32bb9ab950fb73b6a8681bbbaed8e10f86374 (patch) | |
tree | ed84b0db002b04b3aa9b37dbea15b13937de9dab /gcc/c-lang.c | |
parent | 92d99247ad8850e85d50d3e6561c83d066712a18 (diff) | |
download | gcc-91b32bb9ab950fb73b6a8681bbbaed8e10f86374.tar.gz |
* c-lang.c: #include diagnostic.h
(c_tree_printer): New function.
(lang_init): Initialize lang_printer.
* Makefile.in (c-lang.o): Depends on diagnostic.h
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35818 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lang.c')
-rw-r--r-- | gcc/c-lang.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 504f342c70f..ab28b0d44ce 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -28,10 +28,13 @@ Boston, MA 02111-1307, USA. */ #include "c-tree.h" #include "c-lex.h" #include "toplev.h" +#include "diagnostic.h" #include "output.h" #include "flags.h" #include "ggc.h" +static int c_tree_printer PARAMS ((output_buffer *)); + #if USE_CPPLIB #include "cpplib.h" extern char *yy_cur; @@ -92,6 +95,8 @@ lang_init () restore_lang_status = &pop_c_function_context; mark_lang_status = &mark_c_function_context; + lang_printer = c_tree_printer; + c_parse_init (); } @@ -240,3 +245,38 @@ finish_file () } #endif } + +/* Called during diagnostic message formatting process to print a + source-level entity onto BUFFER. The meaning of the format specifiers + is as follows: + %D: a general decl, + %F: a function declaration, + %T: a type. + + These format specifiers form a subset of the format specifiers set used + by the C++ front-end. + Please notice when called, the `%' part was already skipped by the + diagnostic machinery. */ +static int +c_tree_printer (buffer) + output_buffer *buffer; +{ + tree t = va_arg (output_buffer_format_args (buffer), tree); + + switch (*output_buffer_text_cursor (buffer)) + { + case 'D': + case 'F': + case 'T': + { + const char *n = DECL_NAME (t) + ? (*decl_printable_name) (t, 2) + : "({anonymous})"; + output_add_string (buffer, n); + } + return 1; + + default: + return 0; + } +} |