c-pretty-print.c (pp_c_parameter_type_list): Print ...
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 5 Oct 2017 20:08:27 +0000 (20:08 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Thu, 5 Oct 2017 20:08:27 +0000 (20:08 +0000)
2017-10-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* c-pretty-print.c (pp_c_parameter_type_list): Print ... for variadic
functions.

testsuite:
2017-10-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* gcc.dg/Wincompatible-pointer-types-1.c: New test.

From-SVN: r253460

gcc/c-family/ChangeLog
gcc/c-family/c-pretty-print.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c [new file with mode: 0644]

index 58797f074641ca1bafce1d869f96f7c9a62ba30e..639fd2254cc0f537cae7dbcded7edd4909075029 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * c-pretty-print.c (pp_c_parameter_type_list): Print ... for variadic
+       functions.
+
 2017-10-02  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * c-warn.c (warn_tautological_bitwise_comparison): Use wi::to_widest
index b8b8f665ef35eebd98e4d073451c1e3dc680c3d6..745f0fd60113e1fcee85ed4d873db25e8bf5d113 100644 (file)
@@ -521,6 +521,11 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
          else
            pp->abstract_declarator (TREE_VALUE (parms));
        }
+      if (!first && !parms)
+       {
+         pp_separate_with (pp, ',');
+         pp_c_ws_string (pp, "...");
+       }
     }
   pp_c_right_paren (pp);
 }
index 5b7919fc956b41ca22814d5fa426331882dda734..9a3a5c8920a409e4832d14d65895e704cfdea3dc 100644 (file)
@@ -1,3 +1,7 @@
+2017-10-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * gcc.dg/Wincompatible-pointer-types-1.c: New test.
+
 2017-10-05  Tamar Christina  <tamar.christina@arm.com>
 
        * gcc.dg/vect/slp-perm-9.c: Use vect_sizes_16B_8B.
diff --git a/gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c b/gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c
new file mode 100644 (file)
index 0000000..9ffdc2e
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+
+void f (int, ...);
+
+int
+f1 (void)
+{
+  int (*x) ();
+  x = f; /* { dg-error "assignment to 'int \\(\\*\\)\\(\\)' from incompatible pointer type 'void \\(\\*\\)\\(int,  \.\.\.\\)'" } */
+  return x (1);
+}