public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <pcarlini@suse.de>
To: Gabriel Dos Reis <gdr@cs.tamu.edu>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [C++, diagnostic] PR 33494
Date: Mon, 29 Oct 2007 14:25:00 -0000	[thread overview]
Message-ID: <4725CF67.9050908@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0710290633001.12824@gauss.cs.tamu.edu>

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

Hi Gaby,
> Hi Paolo, could we just call pp_cxx_expression instead of the split?
>   
Sure, if we can "export" the entire pp_cxx_expression we can also start
tidying a bit error.c, I started on that in the below, picking some safe
recent bits. Tested x86_64-linux. Is it ok?

By the way, in that context, I'm puzzled by the way pp_cxx_expression
deals with NON_DEPENDENT_EXPR. Is it calling itself or what?

Thanks,
Paolo.

///////////////

[-- Attachment #2: CL_33494_2 --]
[-- Type: text/plain, Size: 531 bytes --]

/cp
2007-10-29  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* cxx-pretty-print.c (pp_cxx_expression): Change to extern linkage.
	(pp_cxx_typeid_expression, pp_cxx_delete_expression): Change to
	static linkage.
	* cxx-pretty-print.h: Adjust declarations.
	* error.c (dump_expr, case EXPR_PACK_EXPANSION, TYPEID_EXPR,
	MEMBER_REF, DOTSTAR_EXPR, DELETE_EXPR, VEC_DELETE_EXPR,
	MODOP_EXPR): Forward to pp_cxx_expression.

/testsuite
2007-10-29  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* g++.dg/template/error35.C: New.

[-- Attachment #3: patch_33494_2 --]
[-- Type: text/plain, Size: 5518 bytes --]

Index: testsuite/g++.dg/template/error35.C
===================================================================
*** testsuite/g++.dg/template/error35.C	(revision 0)
--- testsuite/g++.dg/template/error35.C	(revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/33494
+ 
+ template<int> void foo(int(*f=0)()); // { dg-error "declared void|scope|erroneous-expression" }
Index: cp/error.c
===================================================================
*** cp/error.c	(revision 129707)
--- cp/error.c	(working copy)
*************** dump_expr (tree t, int flags)
*** 2004,2014 ****
        dump_expr (TREE_OPERAND (t, 0), flags);
        break;
  
-     case EXPR_PACK_EXPANSION:
-       dump_expr (PACK_EXPANSION_PATTERN (t), flags);
-       pp_cxx_identifier (cxx_pp, "...");
-       break;
- 
      case ARGUMENT_PACK_SELECT:
        dump_template_argument (ARGUMENT_PACK_SELECT_FROM_PACK (t), flags);
        break;
--- 2004,2009 ----
*************** dump_expr (tree t, int flags)
*** 2040,2049 ****
        pp_cxx_trait_expression (cxx_pp, t);
        break;
  
-     case TYPEID_EXPR:
-       pp_cxx_typeid_expression (cxx_pp, t);
-       break;
- 
      case VA_ARG_EXPR:
        pp_cxx_va_arg_expression (cxx_pp, t);
        break;
--- 2035,2040 ----
*************** dump_expr (tree t, int flags)
*** 2052,2065 ****
        pp_cxx_offsetof_expression (cxx_pp, t);
        break;
  
      case MEMBER_REF:
      case DOTSTAR_EXPR:
-       pp_multiplicative_expression (cxx_pp, t);
-       break;
- 
      case DELETE_EXPR:
      case VEC_DELETE_EXPR:
!       pp_cxx_delete_expression (cxx_pp, t);
        break;
  
        /*  This list is incomplete, but should suffice for now.
--- 2043,2056 ----
        pp_cxx_offsetof_expression (cxx_pp, t);
        break;
  
+     case EXPR_PACK_EXPANSION:
+     case TYPEID_EXPR:
      case MEMBER_REF:
      case DOTSTAR_EXPR:
      case DELETE_EXPR:
      case VEC_DELETE_EXPR:
!     case MODOP_EXPR:
!       pp_cxx_expression (cxx_pp, t);
        break;
  
        /*  This list is incomplete, but should suffice for now.
Index: cp/cxx-pretty-print.c
===================================================================
*** cp/cxx-pretty-print.c	(revision 129717)
--- cp/cxx-pretty-print.c	(working copy)
*************** static void pp_cxx_unqualified_id (cxx_p
*** 31,37 ****
  static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
  static void pp_cxx_qualified_id (cxx_pretty_printer *, tree);
  static void pp_cxx_assignment_expression (cxx_pretty_printer *, tree);
- static void pp_cxx_expression (cxx_pretty_printer *, tree);
  static void pp_cxx_template_argument_list (cxx_pretty_printer *, tree);
  static void pp_cxx_type_specifier_seq (cxx_pretty_printer *, tree);
  static void pp_cxx_ptr_operator (cxx_pretty_printer *, tree);
--- 31,36 ----
*************** static void pp_cxx_abstract_declarator (
*** 43,48 ****
--- 42,48 ----
  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 void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
  \f
  
  static inline void
*************** pp_cxx_new_expression (cxx_pretty_printe
*** 672,678 ****
        ::(opt) delete cast-expression
        ::(opt) delete [ ] cast-expression   */
  
! void
  pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
  {
    enum tree_code code = TREE_CODE (t);
--- 672,678 ----
        ::(opt) delete cast-expression
        ::(opt) delete [ ] cast-expression   */
  
! static void
  pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
  {
    enum tree_code code = TREE_CODE (t);
*************** pp_cxx_assignment_expression (cxx_pretty
*** 964,970 ****
      }
  }
  
! static void
  pp_cxx_expression (cxx_pretty_printer *pp, tree t)
  {
    switch (TREE_CODE (t))
--- 964,970 ----
      }
  }
  
! void
  pp_cxx_expression (cxx_pretty_printer *pp, tree t)
  {
    switch (TREE_CODE (t))
*************** pp_cxx_declaration (cxx_pretty_printer *
*** 2161,2167 ****
      }
  }
  
! void
  pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
  {
    t = TREE_OPERAND (t, 0);
--- 2161,2167 ----
      }
  }
  
! static void
  pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
  {
    t = TREE_OPERAND (t, 0);
Index: cp/cxx-pretty-print.h
===================================================================
*** cp/cxx-pretty-print.h	(revision 129715)
--- cp/cxx-pretty-print.h	(working copy)
*************** void pp_cxx_separate_with (cxx_pretty_pr
*** 70,78 ****
  void pp_cxx_declaration (cxx_pretty_printer *, tree);
  void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
  void pp_cxx_trait_expression (cxx_pretty_printer *, tree);
- void pp_cxx_typeid_expression (cxx_pretty_printer *, tree);
  void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
  void pp_cxx_offsetof_expression (cxx_pretty_printer *, tree);
! void pp_cxx_delete_expression (cxx_pretty_printer *, tree);
  
  #endif /* GCC_CXX_PRETTY_PRINT_H */
--- 70,77 ----
  void pp_cxx_declaration (cxx_pretty_printer *, tree);
  void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree);
  void pp_cxx_trait_expression (cxx_pretty_printer *, tree);
  void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree);
  void pp_cxx_offsetof_expression (cxx_pretty_printer *, tree);
! void pp_cxx_expression (cxx_pretty_printer *, tree);
  
  #endif /* GCC_CXX_PRETTY_PRINT_H */

  reply	other threads:[~2007-10-29 12:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 12:17 Paolo Carlini
2007-10-29 13:21 ` Gabriel Dos Reis
2007-10-29 14:25   ` Paolo Carlini [this message]
2007-11-01  1:41     ` Gabriel Dos Reis
2007-11-01  2:00       ` Gabriel Dos Reis
2007-11-01  2:04         ` Paolo Carlini
2007-11-01  2:04           ` Gabriel Dos Reis
2007-11-01  2:13       ` Paolo Carlini
2007-11-01  2:14         ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4725CF67.9050908@suse.de \
    --to=pcarlini@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdr@cs.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).