[C] Print ", ..." rather than ", ..." in diagnostics
Marek Polacek
polacek@redhat.com
Mon Sep 30 13:02:00 GMT 2019
On Mon, Sep 30, 2019 at 01:57:49PM +0100, Richard Sandiford wrote:
> 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?
Ok.
> 2019-09-30 Richard Sandiford <richard.sandiford@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);
> }
Marek
More information about the Gcc-patches
mailing list