]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport:
authorVolker Reichelt <reichelt@netcologne.de>
Wed, 2 Jan 2008 23:44:10 +0000 (23:44 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Wed, 2 Jan 2008 23:44:10 +0000 (23:44 +0000)
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.

* g++.dg/ext/va-arg1.C: New.

From-SVN: r131266

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/cxx-pretty-print.h
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/va-arg1.C [new file with mode: 0644]

index b4f6477c03dbdf2eef42e03aa364156b433936e0..a794d8ab45fe14f09db379bf1c37e2b5fd7585c6 100644 (file)
@@ -2,6 +2,14 @@
 
        Backport:
        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.
+
+       2007-09-18  Paolo Carlini  <pcarlini@suse.de>
  
        PR c++/33463
        * cxx-pretty-print.c (pp_cxx_postfix_expression): Split
index 1047010950283bc870770eb32c486502e791b484..5dfd7af3f926845d3690f165645374cd7a33f2fb 100644 (file)
@@ -348,7 +348,10 @@ pp_cxx_id_expression (cxx_pretty_printer *pp, tree t)
      :: operator-function-id
      :: qualifier-id
      ( expression )
-     id-expression   */
+     id-expression
+
+   GNU Extensions:
+     __builtin_va_arg ( assignment-expression , type-id )  */
 
 static void
 pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
@@ -386,6 +389,10 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
       pp_cxx_right_paren (pp);
       break;
 
+    case VA_ARG_EXPR:
+      pp_cxx_va_arg_expression (pp, t);
+      break;
+
     default:
       pp_c_primary_expression (pp_c_base (pp), t);
       break;
@@ -1974,6 +1981,17 @@ pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
   pp_cxx_right_paren (pp);
 }
 
+void
+pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t)
+{
+  pp_cxx_identifier (pp, "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);
+}
+
 \f
 typedef c_pretty_print_fn pp_fun;
 
index 5b6272416557b6bc883dfe9eb4be8450c3cf5bc5..4375936cf4af05e9c8a2511540e3333d97605984 100644 (file)
@@ -70,6 +70,7 @@ void pp_cxx_separate_with (cxx_pretty_printer *, int);
 void pp_cxx_declaration (cxx_pretty_printer *, tree);
 void pp_cxx_canonical_template_parameter (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 60cdc1a509b8e150eaed753e06dfdb1be72f0a3b..c62af6553cd6dc8a112ce3ed6920434dcb620dc2 100644 (file)
@@ -1897,6 +1897,10 @@ dump_expr (tree t, int flags)
       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 c053dc4c327d137e911005a05f7fc9fb6d1f3290..181938fed90e0dcbec5cfa3f224d8051365f68d6 100644 (file)
@@ -2,6 +2,11 @@
 
        Backport:
        2007-09-18  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/33462
+       * g++.dg/ext/va-arg1.C: New.
+
+       2007-09-18  Paolo Carlini  <pcarlini@suse.de>
  
        PR c++/33463
        * g++.dg/rtti/typeid6.C: New.
diff --git a/gcc/testsuite/g++.dg/ext/va-arg1.C b/gcc/testsuite/g++.dg/ext/va-arg1.C
new file mode 100644 (file)
index 0000000..079db2e
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/33462
+
+struct A {};
+
+void foo()
+{
+  ++__builtin_va_arg(0, A); // { dg-error "'\\+\\+va_arg\\(0, A\\)'" }
+}