aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2012-04-24 19:21:21 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2012-04-24 19:21:21 +0000
commit88b75041e1fe640e6f1bfd5c3959eeaea05f0ad2 (patch)
tree03ddeb5ba2cc3f34ce5c10654d25ba5d70db6fb7 /gcc/toplev.c
parent34974cd9bd0abd9703156253957b68b617c17716 (diff)
2012-04-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
gcc/ * tree-pretty-print.h (default_tree_printer): Do not declare. * tree-diagnostic.c: Include tree-pretty-print.h, tree-pass.h and intl.h. (default_tree_diagnostic_starter): Make static. (default_tree_printer): Move to here. Make static. (tree_diagnostics_defaults): New. * tree-diagnostic.h (default_tree_diagnostic_starter): Do not declare. * tree.c (free_lang_data): Use tree_diagnostics_defaults. * toplev.c: Do not include tree-pass.h. (default_tree_printer): Move from here. (general_init): Use tree_diagnostics_defaults. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@186780 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c70
1 files changed, 7 insertions, 63 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 574af3bc160..3d9e1626b80 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -74,7 +74,6 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "alloc-pool.h"
#include "tree-mudflap.h"
-#include "tree-pass.h"
#include "gimple.h"
#include "tree-ssa-alias.h"
#include "plugin.h"
@@ -962,63 +961,6 @@ init_asm_output (const char *name)
}
}
-/* Default tree printer. Handles declarations only. */
-bool
-default_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
- int precision, bool wide, bool set_locus, bool hash)
-{
- tree t;
-
- /* FUTURE: %+x should set the locus. */
- if (precision != 0 || wide || hash)
- return false;
-
- switch (*spec)
- {
- case 'E':
- t = va_arg (*text->args_ptr, tree);
- if (TREE_CODE (t) == IDENTIFIER_NODE)
- {
- pp_identifier (pp, IDENTIFIER_POINTER (t));
- return true;
- }
- break;
-
- case 'D':
- t = va_arg (*text->args_ptr, tree);
- if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
- t = DECL_DEBUG_EXPR (t);
- break;
-
- case 'F':
- case 'T':
- t = va_arg (*text->args_ptr, tree);
- break;
-
- case 'K':
- percent_K_format (text);
- return true;
-
- default:
- return false;
- }
-
- if (set_locus && text->locus)
- *text->locus = DECL_SOURCE_LOCATION (t);
-
- if (DECL_P (t))
- {
- const char *n = DECL_NAME (t)
- ? identifier_to_locale (lang_hooks.decl_printable_name (t, 2))
- : _("<anonymous>");
- pp_string (pp, n);
- }
- else
- dump_generic_node (pp, t, 0, TDF_DIAGNOSTIC, 0);
-
- return true;
-}
-
/* A helper function; used as the reallocator function for cpp's line
table. */
static void *
@@ -1163,13 +1105,15 @@ general_init (const char *argv0)
/* Initialize the diagnostics reporting machinery, so option parsing
can give warnings and errors. */
diagnostic_initialize (global_dc, N_OPTS);
- diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
- /* By default print macro expansion contexts in the diagnostic
- finalizer -- for tokens resulting from macro macro expansion. */
- diagnostic_finalizer (global_dc) = virt_loc_aware_diagnostic_finalizer;
/* Set a default printer. Language specific initializations will
override it later. */
- pp_format_decoder (global_dc->printer) = &default_tree_printer;
+ tree_diagnostics_defaults (global_dc);
+ /* FIXME: This should probably be moved to C-family
+ language-specific initializations. */
+ /* By default print macro expansion contexts in the diagnostic
+ finalizer -- for tokens resulting from macro expansion. */
+ diagnostic_finalizer (global_dc) = virt_loc_aware_diagnostic_finalizer;
+
global_dc->show_caret
= global_options_init.x_flag_diagnostics_show_caret;
global_dc->show_option_requested