From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28390 invoked by alias); 27 Sep 2014 16:20:07 -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 28379 invoked by uid 89); 27 Sep 2014 16:20:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 27 Sep 2014 16:20:05 +0000 Received: by mail-wi0-f169.google.com with SMTP id hi2so2497380wib.2 for ; Sat, 27 Sep 2014 09:20:02 -0700 (PDT) X-Received: by 10.180.83.39 with SMTP id n7mr5000757wiy.0.1411834802359; Sat, 27 Sep 2014 09:20:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.80.73 with HTTP; Sat, 27 Sep 2014 09:19:42 -0700 (PDT) In-Reply-To: <87d2akqc1e.fsf@seketeli.org> References: <87d2akqc1e.fsf@seketeli.org> From: =?ISO-8859-1?Q?Manuel_L=F3pez=2DIb=E1=F1ez?= Date: Sat, 27 Sep 2014 16:20:00 -0000 Message-ID: Subject: Re: [RFC/PATCH] Fix-it hints To: Dodji Seketeli Cc: Gcc Patch List , Jason Merrill Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2014-09/txt/msg02467.txt.bz2 On 25 September 2014 11:34, Dodji Seketeli wrote: >> When the caret line is disabled with -fno-diagnostics-show-caret, the >> fix-it hint is printed as: >> >> gcc/testsuite/g++.dg/template/crash83.C:5:21: error: an explicit >> specialization must be preceded by 'template <>' >> gcc/testsuite/g++.dg/template/crash83.C:5:21: fixit: template<> >> >> The latter form may allow an IDE (such as emacs) to automatically >> apply the fix. > > Nice. Is the "fixit:" prefix used by other compilers too? Or are there > variations from compiler to compiler? Clang seems to do: fix-it:"t.cpp":{7:25-7:29}:"Gamma" http://clang.llvm.org/docs/UsersManual.html#cmdoption-fdiagnostics-parseable-fixits where the location is a half-open range (insertions are marked as {7:25-7:25}). However, this is not the standard GNU format for ranges, and last time I tried to update that (to support multiple ranges) RMS was not in favour of adding the Clang flavour. Quoting the filename also does not seem to be what GNU mandates. No idea why they use {} around the location range and not sure if they support just 7:25, which seems nicer. Also, I don't know who are the consumers of Clang's format that GCC will be interested in supporting. No idea about other compilers that support fix-it hints. Comments? > >> Currently, fix-it hints are limited to insertions at one single >> location, whereas Clang allows insertions, deletions, and replacements >> at arbitrary location ranges. > > Do you have example of each of these kinds of fix-it hints? (deletions, > replacement at location ranges). I think it'd be nice to have an idea > of what needs to be done, even if we are not doing it "in extenso" right > now. I think in the case of deletions, they just underline the text to be deleted: typename3.C:3:7: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier] const const long long long int x; ^~~~~~ fix-it:"typename3.C":{3:7-3:13}:"" In the case of replacements, there does not seem to be any visible difference with an insertion: typename3.C:4:33: note: change this ',' to a ';' to call 'f' const const long long long int x, ^ ; fix-it:"typename3.C":{4:33-4:34}:";" Cheers, Manuel.