mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-09 17:11:20 +08:00
c-pretty-print.h (struct c_pretty_print_info): Add new member "constant".
2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net> * c-pretty-print.h (struct c_pretty_print_info): Add new member "constant". (pp_constant): New macro. * c-pretty-print.c (pp_c_pretty_printer_init): Set pp->constant. cp/ 2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net> * cxx-pretty-print.c (pp_cxx_constant): New. Print string-literal in parens if input program says so. (pp_cxx_primary_expression): Hand off constant printing to pp_cxx_constant. (pp_cxx_pretty_printer_init): Set pp->c_base.constant. (pp_cxx_expression): Use pp_cxx_constant for literals. * error.c (dump_expr): Use pp_constant for literals. From-SVN: r109176
This commit is contained in:
parent
cf013e9fdb
commit
a176426f35
@ -1,3 +1,10 @@
|
||||
2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* c-pretty-print.h (struct c_pretty_print_info): Add new member
|
||||
"constant".
|
||||
(pp_constant): New macro.
|
||||
* c-pretty-print.c (pp_c_pretty_printer_init): Set pp->constant.
|
||||
|
||||
2005-12-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
|
||||
|
||||
PR fortran/25586
|
||||
|
@ -2001,6 +2001,7 @@ pp_c_pretty_printer_init (c_pretty_printer *pp)
|
||||
|
||||
pp->statement = pp_c_statement;
|
||||
|
||||
pp->constant = pp_c_constant;
|
||||
pp->id_expression = pp_c_id_expression;
|
||||
pp->primary_expression = pp_c_primary_expression;
|
||||
pp->postfix_expression = pp_c_postfix_expression;
|
||||
|
@ -80,6 +80,7 @@ struct c_pretty_print_info
|
||||
|
||||
c_pretty_print_fn statement;
|
||||
|
||||
c_pretty_print_fn constant;
|
||||
c_pretty_print_fn id_expression;
|
||||
c_pretty_print_fn primary_expression;
|
||||
c_pretty_print_fn postfix_expression;
|
||||
@ -129,6 +130,8 @@ struct c_pretty_print_info
|
||||
#define pp_statement(PPI, S) \
|
||||
pp_c_base (PPI)->statement (pp_c_base (PPI), S)
|
||||
|
||||
#define pp_constant(PP, E) \
|
||||
pp_c_base (PP)->constant (pp_c_base (PP), E)
|
||||
#define pp_id_expression(PP, E) \
|
||||
pp_c_base (PP)->id_expression (pp_c_base (PP), E)
|
||||
#define pp_primary_expression(PPI, E) \
|
||||
|
@ -1,3 +1,13 @@
|
||||
2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* cxx-pretty-print.c (pp_cxx_constant): New. Print
|
||||
string-literal in parens if input program says so.
|
||||
(pp_cxx_primary_expression): Hand off constant printing to
|
||||
pp_cxx_constant.
|
||||
(pp_cxx_pretty_printer_init): Set pp->c_base.constant.
|
||||
(pp_cxx_expression): Use pp_cxx_constant for literals.
|
||||
* error.c (dump_expr): Use pp_constant for literals.
|
||||
|
||||
2005-12-29 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* method.c (make_thunk): Don't set comdat_linkage here.
|
||||
|
@ -292,6 +292,29 @@ pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pp_cxx_constant (cxx_pretty_printer *pp, tree t)
|
||||
{
|
||||
switch (TREE_CODE (t))
|
||||
{
|
||||
case STRING_CST:
|
||||
{
|
||||
const bool in_parens = PAREN_STRING_LITERAL_P (t);
|
||||
if (in_parens)
|
||||
pp_cxx_left_paren (pp);
|
||||
pp_c_constant (pp_c_base (pp), t);
|
||||
if (in_parens)
|
||||
pp_cxx_right_paren (pp);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pp_c_constant (pp_c_base (pp), t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* id-expression:
|
||||
unqualified-id
|
||||
qualified-id */
|
||||
@ -321,10 +344,10 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
|
||||
{
|
||||
switch (TREE_CODE (t))
|
||||
{
|
||||
case STRING_CST:
|
||||
case INTEGER_CST:
|
||||
case REAL_CST:
|
||||
pp_c_constant (pp_c_base (pp), t);
|
||||
case STRING_CST:
|
||||
pp_cxx_constant (pp, t);
|
||||
break;
|
||||
|
||||
case BASELINK:
|
||||
@ -848,7 +871,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
|
||||
case STRING_CST:
|
||||
case INTEGER_CST:
|
||||
case REAL_CST:
|
||||
pp_c_constant (pp_c_base (pp), t);
|
||||
pp_cxx_constant (pp, t);
|
||||
break;
|
||||
|
||||
case RESULT_DECL:
|
||||
@ -1961,6 +1984,7 @@ pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
|
||||
|
||||
/* pp->c_base.statement = (pp_fun) pp_cxx_statement; */
|
||||
|
||||
pp->c_base.constant = (pp_fun) pp_cxx_constant;
|
||||
pp->c_base.id_expression = (pp_fun) pp_cxx_id_expression;
|
||||
pp->c_base.primary_expression = (pp_fun) pp_cxx_primary_expression;
|
||||
pp->c_base.postfix_expression = (pp_fun) pp_cxx_postfix_expression;
|
||||
|
@ -1318,17 +1318,10 @@ dump_expr (tree t, int flags)
|
||||
dump_decl (t, (flags & ~TFF_DECL_SPECIFIERS) | TFF_NO_FUNCTION_ARGUMENTS);
|
||||
break;
|
||||
|
||||
case STRING_CST:
|
||||
if (PAREN_STRING_LITERAL_P (t))
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
pp_c_constant (pp_c_base (cxx_pp), t);
|
||||
if (PAREN_STRING_LITERAL_P (t))
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
break;
|
||||
|
||||
case INTEGER_CST:
|
||||
case REAL_CST:
|
||||
pp_c_constant (pp_c_base (cxx_pp), t);
|
||||
case STRING_CST:
|
||||
pp_constant (cxx_pp, t);
|
||||
break;
|
||||
|
||||
case THROW_EXPR:
|
||||
|
Loading…
x
Reference in New Issue
Block a user