This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 33462


Hi again,

usual story ;) Tested x86_64-linux, Ok for mainline?

Paolo.

///////////////
/cp
2007-09-18  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33462
	* cxx-pretty-print.c (pp_cxx_va_arg_expression): Add.
	(pp_cxx_primary_expression): Use it.
	* cxx-pretty-print.h (pp_cxx_va_arg_expression): Declare.
	* error.c (dump_expr): Use it.

/testsuite
2007-09-18  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33462
	* g++.dg/ext/va-arg1.C: New.
Index: testsuite/g++.dg/ext/va-arg1.C
===================================================================
*** testsuite/g++.dg/ext/va-arg1.C	(revision 0)
--- testsuite/g++.dg/ext/va-arg1.C	(revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/33462
+ 
+ struct A {};
+ 
+ void foo()
+ {
+   ++__builtin_va_arg(0, A); // { dg-error "'\\+\\+__builtin_va_arg\\(0, A\\)'" }
+ }
Index: cp/error.c
===================================================================
*** cp/error.c	(revision 128582)
--- cp/error.c	(working copy)
*************** dump_expr (tree t, int flags)
*** 2062,2067 ****
--- 2062,2071 ----
        pp_cxx_typeid_expression (cxx_pp, t);
        break;
  
+     case VA_ARG_EXPR:
+       pp_cxx_va_arg_expression (cxx_pp, t);
+       break;
+ 
        /*  This list is incomplete, but should suffice for now.
  	  It is very important that `sorry' does not call
  	  `report_error_function'.  That could cause an infinite loop.  */
Index: cp/cxx-pretty-print.c
===================================================================
*** cp/cxx-pretty-print.c	(revision 128582)
--- cp/cxx-pretty-print.c	(working copy)
*************** pp_cxx_id_expression (cxx_pretty_printer
*** 351,356 ****
--- 351,358 ----
       id-expression   
  
     GNU Extensions:
+      __builtin_va_arg ( assignment-expression , type-id )
+ 
       __has_nothrow_assign ( type-id )   
       __has_nothrow_constructor ( type-id )
       __has_nothrow_copy ( type-id )
*************** pp_cxx_primary_expression (cxx_pretty_pr
*** 410,415 ****
--- 412,421 ----
        pp_cxx_trait_expression (pp, t);
        break;
  
+     case VA_ARG_EXPR:
+       pp_cxx_va_arg_expression (pp, t);
+       break;
+ 
      default:
        pp_c_primary_expression (pp_c_base (pp), t);
        break;
*************** pp_cxx_typeid_expression (cxx_pretty_pri
*** 2153,2158 ****
--- 2159,2175 ----
  }
  
  void
+ pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t)
+ {
+   pp_cxx_identifier (pp, "__builtin_va_arg");
+   pp_cxx_left_paren (pp);
+   pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 0));
+   pp_cxx_separate_with (pp, ',');
+   pp_cxx_type_id (pp, TREE_TYPE (t));
+   pp_cxx_right_paren (pp);
+ }
+ 
+ void
  pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
  {
    cp_trait_kind kind = TRAIT_EXPR_KIND (t);
Index: cp/cxx-pretty-print.h
===================================================================
*** cp/cxx-pretty-print.h	(revision 128582)
--- cp/cxx-pretty-print.h	(working copy)
*************** void pp_cxx_declaration (cxx_pretty_prin
*** 71,75 ****
--- 71,76 ----
  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);
  
  #endif /* GCC_CXX_PRETTY_PRINT_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]