From patchwork Thu Oct 5 16:16:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 821913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463551-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="neB89Vc+"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7Hw735qJz9sRm for ; Fri, 6 Oct 2017 03:16:55 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=MHk6hWk0DKOmP7coh07pcNERjZurg36rTHWc2eZ5lPnJ/C7pbx LkurHdKrQTElHCeT6rM/ikNKJuEUwy1oXLy+ywisNll1HsUByr5bMVSyRwpRd1YE 0JXKAC5NMEyO9hruLH3RhkaUY3jxbciUVKbq9x355nw2x7XAUtiQA1iVc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=0X6Y8FpoIuRS8oy3p5ZEpn+Pmy8=; b=neB89Vc+20hYHDsD1F/r A7ufMT0InyIm595W0m8tTH0PYarvO6lo+J2kQPDkZfjXXMZwpyHah6BWbeV4cUHM iFs8MqFJlFMIxUCvK3S2wERjTviBpjTbQpQGf7cJmCwWHmU8yTyS1+OfvknUzx4q 0Qvblth12SCKPulwhyki7mc= Received: (qmail 87043 invoked by alias); 5 Oct 2017 16:16:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 85401 invoked by uid 89); 5 Oct 2017 16:16:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=5216, Hx-languages-length:1350, H*c:HHH X-HELO: EUR02-HE1-obe.outbound.protection.outlook.com Received: from mail-oln040092068060.outbound.protection.outlook.com (HELO EUR02-HE1-obe.outbound.protection.outlook.com) (40.92.68.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Oct 2017 16:16:44 +0000 Received: from VE1EUR02FT011.eop-EUR02.prod.protection.outlook.com (10.152.12.59) by VE1EUR02HT100.eop-EUR02.prod.protection.outlook.com (10.152.13.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.77.10; Thu, 5 Oct 2017 16:16:41 +0000 Received: from AM5PR0701MB2657.eurprd07.prod.outlook.com (10.152.12.59) by VE1EUR02FT011.mail.protection.outlook.com (10.152.12.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.77.10 via Frontend Transport; Thu, 5 Oct 2017 16:16:41 +0000 Received: from AM5PR0701MB2657.eurprd07.prod.outlook.com ([fe80::8c96:1341:5db1:7f8c]) by AM5PR0701MB2657.eurprd07.prod.outlook.com ([fe80::8c96:1341:5db1:7f8c%18]) with mapi id 15.20.0077.018; Thu, 5 Oct 2017 16:16:41 +0000 From: Bernd Edlinger To: "gcc-patches@gcc.gnu.org" CC: Joseph Myers Subject: [PATCH] Print variadic C-functions properly in diagnostics Date: Thu, 5 Oct 2017 16:16:41 +0000 Message-ID: authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=none action=none header.from=hotmail.de; x-incomingtopheadermarker: OriginalChecksum:45183536426D4A45CEA96466F72D8A7BCE5CF9FE60DD247181ED5BBA1EEDB3D5; UpperCasedChecksum:2FEE57C3F4AC771103889C06FCC06AA4943F3500370A76A1AEF9F08E1DBD7B0A; SizeAsReceived:7017; Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [yo3jvvK13+o6Nxi+DgwWzUfOwYR20bom] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VE1EUR02HT100; 6:kbQA7VnXwbVpJXEG2CNVDDRLc+vqFgJz5IiZL2ngcVKdqO7EALu11Q6MNXuNxH/7OJ45hB098Mhd2j4pOvs5oUm1kLwPeBIsAQwWbWPjg7VU29NR5G1fcktPtX6H3POqvYYRxFDmUWdP/k4UW2JEqdg++FEFjvoTFlgUbA5U0eJxcHax2nNrdA4AGf1RISfqNMuPj8Jx51kI6MNDgBd9fT7VBPAYt3+yz5ahV30beOmhFjB1SofPA7J/SnjQcX08AOyxwX5eYS13u7nidXdeUqMxn0paetQ5DLT8uHezP4VZw8KeEtS1yrqZ2KGj/F2L0jJUa4xxEEE31KZjYb28NA==; 5:2urjrMNtQbGTnml7uP+iIAWlx/SR9rqZwL4V0j0Gn1NUsbW425XoWeXGW/yNLw3X7R05FZtbH0XL2LDILZLVHC+7ucKatsYD0CapzysQDyn6/Tmk8AjdEreuu2HEo+81+lOtZkuriJk6bzafI65NBQ==; 24:lXCZ3h3ufV9gNADXGvS5oUnloHZ4oe/LQ67nWZc4xuDRxEwnJn3zxlLlaaJrFo1PVATsS6Lc7ZEuBgjmDw18U+waWQYc/1yzXYQkfEdZMlI=; 7:AT7XD9QQg7IQmgi+2WqIc68qDmnDHhmsUar8mMAUczIsyADUbWaJarAV8h4LupRMzip/3D00A0y5tbGz3wGNV8jMntpyncAaCYUA72mtr7kwrdn9p+gyKZAxwOnbHJKtwDQThDv/0Ii5wU4CSE8aePVCMExsHIRKJazzkK/AyKr85tYOUnkqzQGpkkF9L8LxVK/XRgBvwIAISyx64xffVj9GaA0c5AnvsgGts08x35w= x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: cc5181e1-a157-441b-6af1-08d50c0c761e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:VE1EUR02HT100; x-ms-traffictypediagnostic: VE1EUR02HT100: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031); SRVR:VE1EUR02HT100; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VE1EUR02HT100; x-forefront-prvs: 04519BA941 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:VE1EUR02HT100; H:AM5PR0701MB2657.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2017 16:16:41.2389 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR02HT100 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 * 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. --- 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); +}