From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 473 invoked by alias); 5 Jul 2017 15:32:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 436 invoked by uid 89); 5 Jul 2017 15:32:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=worded, HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Jul 2017 15:32:18 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7207334586; Wed, 5 Jul 2017 15:32:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D7207334586 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dmalcolm@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D7207334586 Received: from ovpn-117-117.phx2.redhat.com (ovpn-117-117.phx2.redhat.com [10.3.117.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DD8E6C423; Wed, 5 Jul 2017 15:32:16 +0000 (UTC) Message-ID: <1499268735.7656.131.camel@redhat.com> Subject: Re: [PATCH] C/C++: add fix-it hints for various missing symbols From: David Malcolm To: Joseph Myers Cc: gcc-patches@gcc.gnu.org Date: Wed, 05 Jul 2017 15:32:00 -0000 In-Reply-To: References: <1499107059-28855-1-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00277.txt.bz2 On Mon, 2017-07-03 at 23:01 +0000, Joseph Myers wrote: > Does the changed location fix bug 7356? The patch as-written doesn't affect that bug, since the patch only affects sites that use c_parser_require and cp_parser_require with certain token types, and the diagnostic in PR 7356 is emitted by the C FE here: 2174 /* This can appear in many cases looking nothing like a 2175 function definition, so we don't give a more specific 2176 error suggesting there was one. */ 2177 c_parser_error (parser, "expected %<=%>, %<,%>, %<;%>, % " 2178 "or %<__attribute__%>"); (the C++ FE handles it, emitting: pr7356.c:1:1: error: ‘a’ does not name a type a//sample ^ ) c_parser_error currently uses the location of the next token, and concats as description of the next token. I tried hacking up c_parser_error to unconditionally attempt to use the location immediately after the previous token. This "fixes" PR 7356, giving: pr7356.c:1:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’ a//sample ^ This error message might be better to be worded in terms of the syntactic thing that came before, which would yield: pr7356.c:1:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ after declaration a//sample ^ or somesuch. Doing so would presumably require adding an extra param to c_parser_error, e.g. an enum describing the syntactic elements that go before. Does this sound worth pursuing as a followup? Thanks Dave