diff options
author | Gabriel Dos Reis <gdr@codesourcery.com> | 2000-08-20 14:57:16 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2000-08-20 14:57:16 +0000 |
commit | 4e1e6a0137ad9da85b63821fb4f2dd70201e018d (patch) | |
tree | ed84b0db002b04b3aa9b37dbea15b13937de9dab /gcc | |
parent | e2840263c7138632298aae686b2acbcf91fb9e77 (diff) | |
download | gcc-4e1e6a0137ad9da85b63821fb4f2dd70201e018d.zip gcc-4e1e6a0137ad9da85b63821fb4f2dd70201e018d.tar.gz gcc-4e1e6a0137ad9da85b63821fb4f2dd70201e018d.tar.bz2 |
c-lang.c: #include diagnostic.h
* 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
From-SVN: r35818
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/c-lang.c | 40 |
3 files changed, 49 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45db746..3a3bc0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2000-08-20 Gabriel Dos Reis <gdr@codesourcery.com> + * 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 + +2000-08-20 Gabriel Dos Reis <gdr@codesourcery.com> + * c-errors.c (pedwarn_c99): Adjust call to report_diagnostic. * diagnostic.c (default_diagnostic_starter, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index ef7d01a..a4ed78b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1102,7 +1102,7 @@ c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \ c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \ flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \ - $(GGC_H) c-lex.h toplev.h output.h function.h + $(GGC_H) c-lex.h toplev.h diagnostic.h output.h function.h c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \ c-common.h $(srcdir)/c-parse.h $(srcdir)/c-gperf.h c-pragma.h input.h \ intl.h flags.h toplev.h output.h mbchar.h $(GGC_H) diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 504f342..ab28b0d4 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; + } +} |