From 4bc4b2b48283df5400da21dfb6bfe5d6864ad035 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Thu, 5 Oct 2017 20:08:27 +0000 Subject: [PATCH] c-pretty-print.c (pp_c_parameter_type_list): Print ... 2017-10-05 Bernd Edlinger * c-pretty-print.c (pp_c_parameter_type_list): Print ... for variadic functions. testsuite: 2017-10-05 Bernd Edlinger * gcc.dg/Wincompatible-pointer-types-1.c: New test. From-SVN: r253460 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-pretty-print.c | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c | 12 ++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 58797f07464..639fd2254cc 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-10-05 Bernd Edlinger + + * c-pretty-print.c (pp_c_parameter_type_list): Print ... for variadic + functions. + 2017-10-02 Richard Sandiford * c-warn.c (warn_tautological_bitwise_comparison): Use wi::to_widest diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index b8b8f665ef3..745f0fd6011 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b7919fc956..9a3a5c8920a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-10-05 Bernd Edlinger + + * gcc.dg/Wincompatible-pointer-types-1.c: New test. + 2017-10-05 Tamar Christina * 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 index 00000000000..9ffdc2effbe --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wincompatible-pointer-types-1.c @@ -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); +} -- 2.30.2