From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23335 invoked by alias); 11 Nov 2018 21:02:40 -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 23315 invoked by uid 89); 11 Nov 2018 21:02:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=dave, Hx-languages-length:1063 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; Sun, 11 Nov 2018 21:02:38 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 749DB89AC1; Sun, 11 Nov 2018 21:02:37 +0000 (UTC) Received: from ovpn-116-30.phx2.redhat.com (ovpn-116-30.phx2.redhat.com [10.3.116.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD70E5D736; Sun, 11 Nov 2018 21:02:36 +0000 (UTC) Message-ID: <1541970156.4619.19.camel@redhat.com> Subject: Re: [PATCH] C/C++: add fix-it hints for missing '&' and '*' (PR c++/87850) From: David Malcolm To: Martin Sebor , Eric Gallager Cc: gcc-patches@gcc.gnu.org Date: Sun, 11 Nov 2018 21:02:00 -0000 In-Reply-To: <4d63c323-14d1-59b7-aead-55a24ee68a85@gmail.com> References: <1541805824-3745-1-git-send-email-dmalcolm@redhat.com> <4d63c323-14d1-59b7-aead-55a24ee68a85@gmail.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00868.txt.bz2 On Sun, 2018-11-11 at 11:01 -0700, Martin Sebor wrote: > On 11/10/2018 12:01 AM, Eric Gallager wrote: > > On 11/9/18, David Malcolm wrote: > > > This patch adds a fix-it hint to various pointer-vs-non-pointer > > > diagnostics, suggesting the addition of a leading '&' or '*'. > > > > > > For example, note the ampersand fix-it hint in the following: > > > > > > demo.c:5:22: error: invalid conversion from 'pthread_key_t' {aka > > > 'unsigned > > > int'} > > > to 'pthread_key_t*' {aka 'unsigned int*'} [-fpermissive] > > > 5 | pthread_key_create(key, NULL); > > > | ^~~ > > > | | > > > | pthread_key_t {aka unsigned int} > > > | & > > > > Having both the type and the fixit underneath the caret looks kind > > of confusing > > I agree it's rather subtle. Keeping the diagnostics separate from > the suggested fix should avoid the confusion. FWIW, the fix-it hint is in a different color (assuming that gcc is invoked in an environment that prints that...) Dave