From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#37633: Column part interpreted wrong in compilation mode Date: Sat, 23 Apr 2022 15:36:25 +0200 Message-ID: <87y1zvsyzq.fsf@gnus.org> References: <2282407.NbK4RY0fEn@daiyu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10635"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 37633@debbugs.gnu.org, anton@mips.complang.tuwien.ac.at To: Bernd Paysan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 23 15:37:11 2022 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 1niFwk-0002a6-N7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Apr 2022 15:37:10 +0200 Original-Received: from localhost ([::1]:44118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niFwj-0008WJ-O6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Apr 2022 09:37:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niFwc-0008Un-Nl for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2022 09:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1niFwc-0004Gl-FI for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2022 09:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1niFwc-0000bP-AI for bug-gnu-emacs@gnu.org; Sat, 23 Apr 2022 09:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Apr 2022 13:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37633 X-GNU-PR-Package: emacs Original-Received: via spool by 37633-submit@debbugs.gnu.org id=B37633.16507209982269 (code B ref 37633); Sat, 23 Apr 2022 13:37:02 +0000 Original-Received: (at 37633) by debbugs.gnu.org; 23 Apr 2022 13:36:38 +0000 Original-Received: from localhost ([127.0.0.1]:55478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1niFwE-0000aX-KW for submit@debbugs.gnu.org; Sat, 23 Apr 2022 09:36:38 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:48222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1niFwC-0000aI-Ge for 37633@debbugs.gnu.org; Sat, 23 Apr 2022 09:36:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JQsyodbP9ipwOreVA3i08EoAlVEk5jJqe0Xck5w/Trg=; b=Aq9TtBe8zah1EhQwEiCH8CfQrQ seLRl1d7nBtVuzKR+qX4P3Dn8NkNB3wCVktgls1MZ5DM2AErCjY7Sp98GtJ0fWePxotNGQHVF6Scb 8DSRQfKbnN+uPi+tv0g9WaRCmiaPjTSruWTx5QS161H7wpAMot+sM0fcex/xPC0HcCjo=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niFw1-00031K-UE; Sat, 23 Apr 2022 15:36:28 +0200 X-Now-Playing: The Style Council's _The Complete Adventures (5)_: "Hope (Feelings Gonna Getcha)" In-Reply-To: <2282407.NbK4RY0fEn@daiyu> (Bernd Paysan's message of "Sat, 05 Oct 2019 13:12:34 +0200") 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:230483 Archived-At: Bernd Paysan writes: > Problems arise when tabs and UTF-8 glyphs are involved, e.g. compile > > ---------------test.c--------------- > void foo() { > printf("test %i", b); > printf("test=E4=BD=A0=E5=A5=BD %i", c); > } > ---------------gcc test.c--------------- > -*- mode: compilation; default-directory: "~/tmp/" -*- > Compilation started at Sat Oct 5 12:13:23 [...] > test.c:3:26: error: =E2=80=98c=E2=80=99 undeclared (first use in this fun= ction) > 3 | printf("test=E4=BD=A0=E5=A5=BD %i", c); > | ^ (I'm going through old bug reports that unfortunately weren't resolved at the time.) Amusingly enough, gcc 11.2.0 said this to me comp.c:4:31: error: 'c' undeclared (first use in this function) 4 | printf("test=E4=BD=A0=E5=A5=BD %i", c); | ^ It's counting the leading TAB character as eight columns... and then counting the bytes of Chinese characters individually, ending up with a column of 31. So just using `filepos-to-bufferpos' wouldn't fix the current gcc. We could implement gcc's logic fully, but that's changing over time, and other compilers surely have their own logic. (I wouldn't be surprised whether other compilers count characters instead of bytes in their column outputs.) And -finput-charset doesn't help with the column calculation in gcc. Since the issue is as messy as it is, I don't think there's anything meaningful we can do here on the Emacs side, so I'm therefore closing this bug report. (If somebody has ideas that would work in general here, please respond and we'll reopen.) --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no