This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add UNARY_PLUS_EXPR to C++ front-end (take 2)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 27 May 2005 12:26:19 -0600 (MDT)
- Subject: Re: [PATCH] Add UNARY_PLUS_EXPR to C++ front-end (take 2)
On Thu, 26 May 2005, Mark Mitchell wrote:
> Gabriel Dos Reis wrote:
> > Roger Sayle <roger@eyesopen.com> writes:
> > Sorry for not having commented earlier, but I think you need to add
> > the pretty printing of UNARY_PLUS_EXPR in cxx-pretty-print.c too.
>
> Yes, this is OK.
Rather than repost the entire patch, I thought it easier on the
reviewers to just post the additional hunk to provide support for
UNARY_PLUS_EXPR in cxx-pretty-print.c. Whilst current mainline
won't ever display a unary plus via the C++ pretty printer, I
agree with Gabriel that the introduction of a new front-end
tree code, with unknown side-effects in the pretty printer logic,
makes handling UNARY_PLUS_EXPR more than just a feature request.
The following hunk together with the previous version of the
UNARY_PLUS_EXPR patch have been tested on x86_64-unknown-linux-gnu
with a full "make bootstrap", all default languages, and regression
tested with a top-level "make -k check" with no new failures.
Unfortunately, I've absolutely no idea how to actually test this
new functionality. Hopefully, anyone that feels strongly enough
to require a new testcase, can suggest/commit one themselves.
Ok to commit both patches simultaneously?
2005-05-26 Roger Sayle <roger@eyesopen.com>
* cxx-pretty-print.c (pp_cxx_cast_expression): Prototype.
(pp_cxx_unary_expression): Handle new UNARY_PLUS_EXPR tree code.
Index: cxx-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cxx-pretty-print.c,v
retrieving revision 1.33
diff -c -3 -p -r1.33 cxx-pretty-print.c
*** cxx-pretty-print.c 25 Apr 2005 19:03:40 -0000 1.33
--- cxx-pretty-print.c 27 May 2005 05:18:33 -0000
*************** static void pp_cxx_parameter_declaration
*** 43,48 ****
--- 43,49 ----
static void pp_cxx_abstract_declarator (cxx_pretty_printer *, tree);
static void pp_cxx_statement (cxx_pretty_printer *, tree);
static void pp_cxx_template_parameter (cxx_pretty_printer *, tree);
+ static void pp_cxx_cast_expression (cxx_pretty_printer *, tree);
static inline void
*************** pp_cxx_unary_expression (cxx_pretty_prin
*** 640,645 ****
--- 641,651 ----
pp_unary_expression (pp, TREE_OPERAND (t, 0));
break;
+ case UNARY_PLUS_EXPR:
+ pp_plus (pp);
+ pp_cxx_cast_expression (pp, TREE_OPERAND (t, 0));
+ break;
+
default:
pp_c_unary_expression (pp_c_base (pp), t);
break;
Roger
--