From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Malcolm Newsgroups: gmane.emacs.bugs Subject: bug#25987: 25.2; support gcc fixit notes Date: Tue, 06 Oct 2020 14:17:55 -0400 Message-ID: References: <87lgsj1jle.fsf@tromey.com> <1521218887.2913.237.camel@redhat.com> <83muz7pyde.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35877"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) Cc: 25987@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 06 20:19:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPrYM-0009DW-4h for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 20:19:10 +0200 Original-Received: from localhost ([::1]:58254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrYL-0007wM-4M for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Oct 2020 14:19:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrYE-0007w4-JR for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 14:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPrYE-0004l3-AV for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 14:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kPrYE-00041A-7L for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2020 14:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Malcolm Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Oct 2020 18:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25987 X-GNU-PR-Package: emacs Original-Received: via spool by 25987-submit@debbugs.gnu.org id=B25987.160200828415374 (code B ref 25987); Tue, 06 Oct 2020 18:19:02 +0000 Original-Received: (at 25987) by debbugs.gnu.org; 6 Oct 2020 18:18:04 +0000 Original-Received: from localhost ([127.0.0.1]:54108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPrXH-0003zu-T3 for submit@debbugs.gnu.org; Tue, 06 Oct 2020 14:18:04 -0400 Original-Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPrXE-0003zS-Ig for 25987@debbugs.gnu.org; Tue, 06 Oct 2020 14:18:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602008280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=utkPp9rT1g++RKRA1gcFaa64mBtC+gEOqw5FDxNcyUE=; b=MWcRs5o6StCWK9VkFIuy9C2QKFg2d0f0XN4fFPS4DmZtfixGqjCRjRTL+uPH7LAohPRVNT +2UnlT/TxngQhD9MhnGki/Ow3FCl9Jj/QCnGMIxrtnfA+uXzOtG6gigpNsK7oLmUgY+wMJ f8ywDvkHAd3KC4EnJmDZ1QVpqyCCaW8= Original-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-nVZ4H36qMOWtiNWVrsuROQ-1; Tue, 06 Oct 2020 14:17:57 -0400 X-MC-Unique: nVZ4H36qMOWtiNWVrsuROQ-1 Original-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCD9956BFE; Tue, 6 Oct 2020 18:17:56 +0000 (UTC) Original-Received: from ovpn-112-135.phx2.redhat.com (ovpn-112-135.phx2.redhat.com [10.3.112.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 539936EF43; Tue, 6 Oct 2020 18:17:56 +0000 (UTC) In-Reply-To: <83muz7pyde.fsf@gnu.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmalcolm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189924 Archived-At: On Fri, 2018-03-16 at 22:19 +0200, Eli Zaretskii wrote: > > From: David Malcolm > > Date: Fri, 16 Mar 2018 12:48:07 -0400 > > > > It appears that Emacs can already decode from byte-offsets in a > > line > > back to columns > > Actually, doing this translation is a pain, because it requires to > know the original encoding used by GCC for its messages, and that > info > is gone by the time we have the text decoded in an Emacs buffer. > Emacs can guess the encoding, but that guesswork is bound to > fail. So > reporting the offsets in characters (a.k.a. columns) is really a > necessity. > > Thanks. Sorry for the long delay in responding. In GCC 11 we've revamped the column number handling in how we emit diagnostics; see: https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555632.html GCC 11 diagnostics now (by default) should use actual column numbers, rather than byte counts. We haven't changed -fdiagnostics-parseable-fixits; it still emits its range information in terms of byte offsets (and e.g. Eclipse already consumes that option); this is bug-for-bug compatible with clang, I believe (which had that option first). Note that characters != columns, or, at least, we have to be careful about what we mean. Consider the case of 🙂 aka SLIGHTLY SMILING FACE (U+1F642) which is a single unicode code point, but occupies two columns, with its UTF-8 encoding requiring four bytes. When I type it into an Emacs buffer, and look at the column number I see that Emacs appears to treat the character as occupying two columns. Is that the kind of column numbering you would want for machine- readable fix-it hints? Similarly, the column numbering emitted by GCC 11 diagnostics is affected by tab characters as tab stops, which seems to reflect Emacs behavior as well. I can add an additional option for fix-it hints that's similar to -fdiagnostics-parseable-fixits, but with a different output format (or to add an argument to that option, perhaps). Before I do that, I wanted to check that it would be consumable by Emacs. What works for you? Would it help to send the proposed GCC patch to this bug address (or to the emacs-devel list?). The existing option is documented here: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-parseable-fixits Alternatively, we already have a JSON output option (-fdiagnostics- format=json); perhaps something like that could be used? Feature freeze for GCC 11 is about a month away; I'd love for Emacs to be able to consume GCC fix-it hints (and have GCC and Emacs fix my typos for me) Dave