Hi! This fixes the c-pretty-printing of variadic function types by adding ", ..." to the output of the function parameters.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd.
c-family: 2017-10-05 Bernd Edlinger <bernd.edlin...@hotmail.de> * c-pretty-print.c (pp_c_parameter_type_list): Print ... for variadic functions. testsuite: 2017-10-05 Bernd Edlinger <bernd.edlin...@hotmail.de> * gcc.dg/Wincompatible-pointer-types-1.c: New test. --- gcc/c-family/c-pretty-print.c 2017-08-07 10:37:07.000000000 +0200 +++ gcc/c-family/c-pretty-print.c 2017-10-04 12:38:09.412750910 +0200 @@ -521,6 +521,11 @@ pp_c_parameter_type_list (c_pretty_print else pp->abstract_declarator (TREE_VALUE (parms)); } + if (!first && !parms) + { + pp_separate_with (pp, ','); + pp_c_ws_string (pp, "..."); + } } pp_c_right_paren (pp); } --- /dev/null 2017-09-18 13:50:08.343098047 +0200 +++ gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c 2017-10-04 18:05:24.172717734 +0200 @@ -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); +}