summaryrefslogtreecommitdiffstats
path: root/gcc/cp
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-05 19:23:14 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-05 19:23:14 +0000
commit0de2b732140837dba441a8ae38145e15143cdc58 (patch)
treec9868a248f403aa9b1d76b6b3cc12ee64a26d1b1 /gcc/cp
parentfa1fcea85db9f807a874bf913d616ae421806f06 (diff)
downloadppe42-gcc-0de2b732140837dba441a8ae38145e15143cdc58.tar.gz
ppe42-gcc-0de2b732140837dba441a8ae38145e15143cdc58.zip
* pretty-print.h (pp_set_line_maximum_length): Make macro.
(pp_set_prefix): Likewise. (pp_destroy_prefix): Likewise. (pp_remaining_character_count_for_line): Likewise. (pp_clear_output_area): Likewise. (pp_formatted_text): Likewise. (pp_last_position_in_text): Likewise. (pp_emit_prefix): Likewise. (pp_append_text): Likewise. (pp_flush): Likewise. (pp_format_text): Likewise. (pp_format_verbatim): Likewise. (pp_tree_identifier): Tidy. * pretty-print.c (pp_base_format_text): Rename from pp_format_text. (pp_base_format_verbatim): Rename from pp_format_verbatim. (pp_base_flush): Rename from pp_flush. (pp_base_set_line_maximum_length): Rename from pp_set_line_maximum_length. (pp_base_clear_output_area): Rename from pp_clear_output_area. (pp_base_set_prefix): Rename from pp_set_prefix. (pp_base_destroy_prefix): Rename from pp_destroy_prefix. (pp_base_emit_prefix): Rename from pp_emit_prefix. (pp_base_append_text): Rename from pp_append_text. (pp_base_formatted_text): Rename from pp_formatted_text. (pp_base_last_position_in_text): Rename from pp_last_position_in_text. (pp_base_remaining_character_count_for_line): Rename from pp_remaining_character_count_for_line. * diagnostic.h (diagnostic_format_decoder): Tidy. (diagnostic_flush_buffer): Likewise. * c-pretty-print.h: (pp_c_string_literal): Declare. (pp_c_real_literal): Likewise. (pp_c_integer_literal): Likewise. * c-pretty-print.c (pp_c_char): Use pp_string in lieu of pp_identifier. (pp_c_character_literal): Tidy. (pp_c_string_literal): Make public. (pp_c_bool_literal): Likewise. (pp_c_integer_literal): Likewise. (pp_c_real_literal): Likewise. * Makefile.in (C_PRETTY_PRINT_H): New variable. (c-pretty-print.o): Update dependence. cp/ * cxx-pretty-print.h: New file. * cxx-pretty-print.c: Likewise. * error.c (scratch_pretty_printer): Change type. (init_error): Tidy. (dump_aggr_type): Likewise. (dump_global_iord): Likewise. (dump_expr): Likewise. (dump_char): Remove. * cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define. (cxx_initialize_diagnostics): New function. * Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o (CXX_PRETTY_PRINT_H): New variable. (cp/cxx-pretty-print.o): New rule. (cp/cp-lang.o): Update dependence. (cp/error.o): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70182 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/Make-lang.in13
-rw-r--r--gcc/cp/cp-lang.c20
-rw-r--r--gcc/cp/cxx-pretty-print.c157
-rw-r--r--gcc/cp/cxx-pretty-print.h44
-rw-r--r--gcc/cp/error.c134
6 files changed, 269 insertions, 117 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4cc62ac9408..531d4e88aa2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,21 @@
+2003-08-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * cxx-pretty-print.h: New file.
+ * cxx-pretty-print.c: Likewise.
+ * error.c (scratch_pretty_printer): Change type.
+ (init_error): Tidy.
+ (dump_aggr_type): Likewise.
+ (dump_global_iord): Likewise.
+ (dump_expr): Likewise.
+ (dump_char): Remove.
+ * cp-lang.c (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): Define.
+ (cxx_initialize_diagnostics): New function.
+ * Make-lang.in (CXX_OBJS): Add cp/cxx-pretty-print.o
+ (CXX_PRETTY_PRINT_H): New variable.
+ (cp/cxx-pretty-print.o): New rule.
+ (cp/cp-lang.o): Update dependence.
+ (cp/error.o): Likewise.
+
2003-08-05 Steven Bosscher <steven@gcc.gnu.org>
* cp-tree.h (struct lang_decl): Don't include c_lang_decl.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 05a3a8c4b44..2eeabca735e 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -86,8 +86,8 @@ CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
- cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \
- cp/optimize.o cp/mangle.o cp/cp-lang.o cp/name-lookup.o
+ cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
+ cp/mangle.o cp/cp-lang.o cp/name-lookup.o cp/cxx-pretty-print.o
# Use strict warnings for this front end.
cp-warn = $(STRICT_WARN) $(WERROR)
@@ -231,10 +231,12 @@ CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h c-common.h \
$(GGC_H) \
$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
+CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
+
cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h \
c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H)
cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
- $(LANGHOOKS_DEF_H) c-common.h
+ $(LANGHOOKS_DEF_H) c-common.h $(CXX_PRETTY_PRINT_H) $(DIAGNOSTIC_H)
cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
@@ -266,7 +268,7 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/lex.h \
toplev.h $(RTL_H) except.h tree-inline.h gt-cp-pt.h
cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
- flags.h real.h $(LANGHOOKS_DEF_H)
+ flags.h real.h $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H)
cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h diagnostic.h \
gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) cp/lex.h except.h toplev.h \
@@ -281,3 +283,6 @@ cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h outpu
cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h
+
+cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
+ $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H)
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index ab0d305b2aa..364c384cba3 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -29,6 +29,8 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "langhooks.h"
#include "langhooks-def.h"
+#include "diagnostic.h"
+#include "cxx-pretty-print.h"
enum c_language_kind c_language = clk_cxx;
@@ -38,6 +40,7 @@ static bool cxx_warn_unused_global_decl (tree);
static tree cp_expr_size (tree);
static size_t cp_tree_size (enum tree_code);
static bool cp_var_mod_type_p (tree);
+static void cxx_initialize_diagnostics (diagnostic_context *);
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C++"
@@ -51,6 +54,8 @@ static bool cp_var_mod_type_p (tree);
#define LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
+#undef LANG_HOOKS_INITIALIZE_DIAGNOSTITCS
+#define LANG_HOOKS_INITIALIZE_DIAGNOSTITCS cxx_initialize_diagnostics
#undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
#undef LANG_HOOKS_HANDLE_FILENAME
@@ -373,3 +378,18 @@ c_reset_state (void)
{
sorry ("inter-module optimisations not implemented yet");
}
+
+/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed
+ that CONTEXT->printer is an already constructed basic pretty_printer. */
+static void
+cxx_initialize_diagnostics (diagnostic_context *context)
+{
+ pretty_printer *base = context->printer;
+ cxx_pretty_printer *pp = xmalloc (sizeof (cxx_pretty_printer));
+ memcpy (pp_base (pp), base, sizeof (pretty_printer));
+ pp_cxx_pretty_printer_init (pp);
+ context->printer = (pretty_printer *) pp;
+
+ /* It is safe to free this object because it was previously malloc()'d. */
+ free (base);
+}
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
new file mode 100644
index 00000000000..1595ede1a45
--- /dev/null
+++ b/gcc/cp/cxx-pretty-print.c
@@ -0,0 +1,157 @@
+/* Implementation of subroutines for the GNU C++ pretty-printer.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "real.h"
+#include "cxx-pretty-print.h"
+#include "cp-tree.h"
+
+/* Declarations. */
+
+void
+pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_declaration_specifiers (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_type_specifier (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_declarator (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_parameter_declaration (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+/* Statements. */
+
+void
+pp_cxx_statement (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+/* Expressions. */
+
+static void
+pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_initializer (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_multiplicatice_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_conditional_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+static void
+pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+void
+pp_cxx_expression (cxx_pretty_printer *pp, tree t)
+{
+ pp_unsupported_tree (pp, t);
+}
+
+
+
+typedef c_pretty_print_fn pp_fun;
+
+void
+pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
+{
+ pp_c_pretty_printer_init (pp_c_base (pp));
+
+ pp->c_base.declaration = (pp_fun) pp_cxx_declaration;
+ pp->c_base.declaration_specifiers = (pp_fun) pp_cxx_declaration_specifiers;
+ pp->c_base.type_specifier = (pp_fun) pp_cxx_type_specifier;
+ pp->c_base.declarator = (pp_fun) pp_cxx_declarator;
+ pp->c_base.direct_declarator = (pp_fun) pp_cxx_direct_declarator;
+ pp->c_base.parameter_declaration = (pp_fun) pp_cxx_parameter_declaration;
+ pp->c_base.type_id = (pp_fun) pp_cxx_type_id;
+ pp->c_base.statement = (pp_fun) pp_cxx_statement;
+ pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
+ pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
+ pp->c_base.unary_expression = (pp_fun) pp_cxx_unary_expression;
+ pp->c_base.initializer = (pp_fun) pp_cxx_initializer;
+ pp->c_base.multiplicative_expression = (pp_fun) pp_cxx_multiplicatice_expression;
+ pp->c_base.conditional_expression = (pp_fun) pp_cxx_conditional_expression;
+ pp->c_base.assignment_expression = (pp_fun) pp_cxx_assignment_expression;
+ pp->enclosing_scope = NULL;
+}
diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h
new file mode 100644
index 00000000000..aa93ba4b852
--- /dev/null
+++ b/gcc/cp/cxx-pretty-print.h
@@ -0,0 +1,44 @@
+/* Interface for the GNU C++ pretty-printer.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+#ifndef GCC_CXX_PRETTY_PRINT_H
+#define GCC_CXX_PRETTY_PRINT_H
+
+#include "c-pretty-print.h"
+
+#undef pp_c_base
+#define pp_c_base(PP) (&(PP)->c_base)
+
+typedef struct
+{
+ struct c_pretty_print_info c_base;
+ /* This is the enclosing scope of the entity being pretty-printed. */
+ tree enclosing_scope;
+} cxx_pretty_printer;
+
+void pp_cxx_pretty_printer_init (cxx_pretty_printer *);
+
+void pp_cxx_declaration (cxx_pretty_printer *, tree);
+void pp_cxx_statement (cxx_pretty_printer *, tree);
+void pp_cxx_expression (cxx_pretty_printer *, tree);
+
+
+#endif /* GCC_CXX_PRETTY_PRINT_H */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 491e56a862c..cb317033658 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "diagnostic.h"
#include "langhooks-def.h"
-#include "pretty-print.h"
+#include "cxx-pretty-print.h"
enum pad { none, before, after };
@@ -43,7 +43,7 @@ enum pad { none, before, after };
/* The global buffer where we dump everything. It is there only for
transitional purpose. It is expected, in the near future, to be
completely removed. */
-static pretty_printer scratch_pretty_printer;
+static cxx_pretty_printer scratch_pretty_printer;
#define cxx_pp (&scratch_pretty_printer)
# define NEXT_CODE(T) (TREE_CODE (TREE_TYPE (T)))
@@ -78,7 +78,6 @@ static void dump_function_name (tree, int);
static void dump_expr_list (tree, int);
static void dump_global_iord (tree);
static enum pad dump_qualifiers (tree, enum pad);
-static void dump_char (int);
static void dump_parameters (tree, int);
static void dump_exception_spec (tree, int);
static const char *class_key_or_enum (tree);
@@ -99,7 +98,7 @@ 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 void pp_non_consecutive_character (pretty_printer *, int);
+static void pp_non_consecutive_character (cxx_pretty_printer *, int);
static tree locate_error (const char *, va_list);
static location_t location_of (tree);
@@ -110,7 +109,8 @@ init_error (void)
diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = cp_printer;
- pp_construct (cxx_pp, NULL, 0);
+ pp_construct (pp_base (cxx_pp), NULL, 0);
+ pp_cxx_pretty_printer_init (cxx_pp);
}
/* Dump a scope, if deemed necessary. */
@@ -531,7 +531,7 @@ dump_aggr_type (tree t, int flags)
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_identifier (cxx_pp, "<anonymous>");
else
- pp_printf (cxx_pp, "<anonymous %s>", variety);
+ pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
}
else
pp_tree_identifier (cxx_pp, name);
@@ -758,7 +758,7 @@ dump_global_iord (tree t)
else
abort ();
- pp_printf (cxx_pp, "(static %s for %s)", p, input_filename);
+ pp_printf (pp_base (cxx_pp), "(static %s for %s)", p, input_filename);
}
static void
@@ -1315,50 +1315,6 @@ dump_template_parms (tree info, int primary, int flags)
pp_template_argument_list_end (cxx_pp);
}
-static void
-dump_char (int c)
-{
- switch (c)
- {
- case TARGET_NEWLINE:
- pp_string (cxx_pp, "\\n");
- break;
- case TARGET_TAB:
- pp_string (cxx_pp, "\\t");
- break;
- case TARGET_VT:
- pp_string (cxx_pp, "\\v");
- break;
- case TARGET_BS:
- pp_string (cxx_pp, "\\b");
- break;
- case TARGET_CR:
- pp_string (cxx_pp, "\\r");
- break;
- case TARGET_FF:
- pp_string (cxx_pp, "\\f");
- break;
- case TARGET_BELL:
- pp_string (cxx_pp, "\\a");
- break;
- case '\\':
- pp_string (cxx_pp, "\\\\");
- break;
- case '\'':
- pp_string (cxx_pp, "\\'");
- break;
- case '\"':
- pp_string (cxx_pp, "\\\"");
- break;
- default:
- if (ISPRINT (c))
- pp_character (cxx_pp, c);
- else
- pp_scalar (cxx_pp, "\\%03o", (unsigned) c);
- break;
- }
-}
-
/* Print out a list of initializers (subr of dump_expr) */
static void
@@ -1418,55 +1374,16 @@ dump_expr (tree t, int flags)
pp_left_paren (cxx_pp);
dump_type (type, flags);
pp_right_paren (cxx_pp);
- goto do_int;
- }
- }
- else if (type == boolean_type_node)
- {
- if (t == boolean_false_node || integer_zerop (t))
- pp_identifier (cxx_pp, "false");
- else if (t == boolean_true_node)
- pp_identifier (cxx_pp, "true");
- }
- else if (type == char_type_node)
- {
- pp_quote (cxx_pp);
- if (host_integerp (t, TREE_UNSIGNED (type)))
- dump_char (tree_low_cst (t, TREE_UNSIGNED (type)));
- else
- pp_printf (cxx_pp, "\\x%x",
- (unsigned int) TREE_INT_CST_LOW (t));
- pp_quote (cxx_pp);
- }
- else
- {
- do_int:
- if (! host_integerp (t, 0))
- {
- tree val = t;
-
- if (tree_int_cst_sgn (val) < 0)
- {
- pp_minus (cxx_pp);
- val = build_int_2 (-TREE_INT_CST_LOW (val),
- ~TREE_INT_CST_HIGH (val)
- + !TREE_INT_CST_LOW (val));
- }
- sprintf (cxx_pp->buffer->digit_buffer,
- HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- TREE_INT_CST_HIGH (val), TREE_INT_CST_LOW (val));
- pp_string (cxx_pp, cxx_pp->buffer->digit_buffer);
+ pp_c_integer_literal (pp_c_base (cxx_pp), t);
}
- else
- pp_wide_integer (cxx_pp, TREE_INT_CST_LOW (t));
}
+ else
+ pp_c_integer_literal (pp_c_base (cxx_pp), t);
}
break;
case REAL_CST:
- real_to_decimal (cxx_pp->buffer->digit_buffer, &TREE_REAL_CST (t),
- sizeof (cxx_pp->buffer->digit_buffer), 0, 1);
- pp_string (cxx_pp, cxx_pp->buffer->digit_buffer);
+ pp_c_real_literal (pp_c_base (cxx_pp), t);
break;
case PTRMEM_CST:
@@ -1477,16 +1394,7 @@ dump_expr (tree t, int flags)
break;
case STRING_CST:
- {
- const char *p = TREE_STRING_POINTER (t);
- int len = TREE_STRING_LENGTH (t) - 1;
- int i;
-
- pp_doublequote (cxx_pp);
- for (i = 0; i < len; i++)
- dump_char (p[i]);
- pp_doublequote (cxx_pp);
- }
+ pp_c_string_literal (pp_c_base (cxx_pp), t);
break;
case COMPOUND_EXPR:
@@ -2268,7 +2176,7 @@ void
cxx_print_error_function (diagnostic_context *context, const char *file)
{
lhd_print_error_function (context, file);
- pp_set_prefix (context->printer, file);
+ pp_base_set_prefix (context->printer, file);
maybe_print_instantiation_context (context);
}
@@ -2279,14 +2187,14 @@ cp_diagnostic_starter (diagnostic_context *context,
diagnostic_report_current_module (context);
cp_print_error_function (context, diagnostic);
maybe_print_instantiation_context (context);
- pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
+ pp_base_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
}
static void
cp_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
{
- pp_destroy_prefix (context->printer);
+ pp_base_destroy_prefix (context->printer);
}
/* Print current function onto BUFFER, in the process of reporting
@@ -2302,18 +2210,18 @@ cp_print_error_function (diagnostic_context *context,
? file_name_as_prefix (diagnostic->location.file)
: NULL;
- pp_set_prefix (context->printer, new_prefix);
+ pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
- pp_string (context->printer, "At global scope:");
+ pp_base_string (context->printer, "At global scope:");
else
pp_printf (context->printer, "In %s `%s':",
function_category (current_function_decl),
cxx_printable_name (current_function_decl, 2));
- pp_newline (context->printer);
+ pp_base_newline (context->printer);
diagnostic_set_last_function (context);
- pp_destroy_prefix (context->printer);
+ pp_base_destroy_prefix (context->printer);
context->printer->prefix = old_prefix;
}
}
@@ -2461,7 +2369,7 @@ cp_printer (pretty_printer *pp, text_info *text)
return false;
}
- pp_string (pp, result);
+ pp_base_string (pp, result);
return true;
#undef next_tree
#undef next_tcode
@@ -2470,7 +2378,7 @@ cp_printer (pretty_printer *pp, text_info *text)
}
static void
-pp_non_consecutive_character (pretty_printer *pp, int c)
+pp_non_consecutive_character (cxx_pretty_printer *pp, int c)
{
const char *p = pp_last_position_in_text (pp);
OpenPOWER on IntegriCloud