pp_separate_with inserts a space after the separator, so there's
no need to add whitespace before "..." as well.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  Bordering on obvious,
but I wasn't 100% sure if this would be the preferred fix or not, so...
OK to install?

Richard


2019-09-30  Richard Sandiford  <richard.sandif...@arm.com>

gcc/c-family/
        * c-pretty-print.c (pp_c_parameter_type_list): Avoid printing
        two spaces between a comma and "...".

gcc/testsuite/
        * gcc.dg/Wincompatible-pointer-types-1.c (f1): Expect only one
        space between the comma and "...".

Index: gcc/c-family/c-pretty-print.c
===================================================================
--- gcc/c-family/c-pretty-print.c       2019-03-08 18:14:25.857009653 +0000
+++ gcc/c-family/c-pretty-print.c       2019-09-30 13:54:18.387750214 +0100
@@ -525,7 +525,7 @@ pp_c_parameter_type_list (c_pretty_print
       if (!first && !parms)
        {
          pp_separate_with (pp, ',');
-         pp_c_ws_string (pp, "...");
+         pp_string (pp, "...");
        }
     }
   pp_c_right_paren (pp);
Index: gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c
===================================================================
--- gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c        2019-03-08 
18:15:05.048860662 +0000
+++ gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c        2019-09-30 
13:54:18.387750214 +0100
@@ -7,6 +7,6 @@ void f (int, ...);
 f1 (void)
 {
   int (*x) ();
-  x = f; /* { dg-error "assignment to 'int \\(\\*\\)\\(\\)' from incompatible 
pointer type 'void \\(\\*\\)\\(int,  \.\.\.\\)'" } */
+  x = f; /* { dg-error "assignment to 'int \\(\\*\\)\\(\\)' from incompatible 
pointer type 'void \\(\\*\\)\\(int, \.\.\.\\)'" } */
   return x (1);
 }

Reply via email to