From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82889 invoked by alias); 12 Nov 2018 20:38:03 -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 82880 invoked by uid 89); 12 Nov 2018 20:38:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=organizations X-HELO: mail-qk1-f196.google.com Received: from mail-qk1-f196.google.com (HELO mail-qk1-f196.google.com) (209.85.222.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Nov 2018 20:38:01 +0000 Received: by mail-qk1-f196.google.com with SMTP id o89so15749197qko.0 for ; Mon, 12 Nov 2018 12:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=b+b8U1U82YalFAyat/vL6K5Go9YvhXFJVcr/TVYF1ts=; b=vaem6tErf5s0GvVNAosfkmd4+YjNPBmc5Kt8lsbY2xJVpO+WqdHiSQEmTVWdvvNY9k S4nwhFAa4nd53Jb1B9RECWH8NK6RXqutQ0fOi+10wiDv3HVKhPu2mx4vImodP8BO0TH+ CvFXBfTBYOzruwFDDAS9mEokcenO6QXtMqTZOfv8tWpjTlhfKeN1ly70biPDgxx0Sfrt o3vgUjdJQYApCHMeMCzrv+OfbUZrRbdQKRS17iIRs0lUI8fcTHOQVzZryl09UWCjj9zi jqN32YniIMlz+32spFIwD0D3K3yDnx8FuPJXsW47uKyL5vSuSRpYMvN9c7zMYYHh5JQJ iHag== Return-Path: Received: from localhost.localdomain (184-96-239-209.hlrn.qwest.net. [184.96.239.209]) by smtp.gmail.com with ESMTPSA id l73sm6352109qkl.16.2018.11.12.12.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 12:37:58 -0800 (PST) Subject: Re: [PATCH] RFC: elide repeated source locations (PR other/84889) To: David Malcolm , gcc-patches@gcc.gnu.org References: <1541990633-4614-1-git-send-email-dmalcolm@redhat.com> From: Martin Sebor Message-ID: <37cb2057-f9dd-828d-5428-46f85e1c3c83@gmail.com> Date: Mon, 12 Nov 2018 20:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1541990633-4614-1-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00992.txt.bz2 On 11/11/2018 07:43 PM, David Malcolm wrote: > We often emit more than one diagnostic at the same source location. > For example, the C++ frontend can emit many diagnostics at > the same source location when suggesting overload candidates. > > For example: > > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C: In function 'int test_3(s, t)': > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: error: no match for 'operator&&' (operand types are 's' and 't') > 38 | return param_s && param_t; > | ~~~~~~~~^~~~~~~~~~ > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: note: candidate: 'operator&&(bool, bool)' > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: note: no known conversion for argument 2 from 't' to 'bool' > > This is overly verbose. Note how the same location has been printed > three times, obscuring the pertinent messages. > > This patch add a new "elide" value to -fdiagnostics-show-location= > and makes it the default (previously it was "once"). With elision > the above is printed as: > > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C: In function 'int test_3(s, t)': > ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: error: no match for 'operator&&' (operand types are 's' and 't') > 38 | return param_s && param_t; > | ~~~~~~~~^~~~~~~~~~ > = note: candidate: 'operator&&(bool, bool)' > = note: no known conversion for argument 2 from 't' to 'bool' > > where the followup notes are printed with a '=' lined up with > the source code margin. > > Thoughts? I agree the long pathname in the notes is at first glance redundant but I'm not sure about using '=' as a shorthand for it. I have written many scripts to parse GCC output to extract all diagnostics (including notes) and publish those on a Web page somewhere, as I'm sure must have others. All those scripts would stop working with this change and require changes to the build system to work again. Making those changes can be a substantial undertaking in some organizations. Have you considered printing just the file name instead? Or any other alternatives? Martin