From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#51882: Handle GCC's -fanalyzer output in M-x compile Date: Mon, 15 Nov 2021 23:13:05 +0000 Message-ID: <87ee7hm2ri.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40270"; mail-complaints-to="usenet@ciao.gmane.io" To: 51882@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 16 00:14:21 2021 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 1mmlB7-000AFS-CO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Nov 2021 00:14:21 +0100 Original-Received: from localhost ([::1]:42444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmlB2-0003h6-Qe for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Nov 2021 18:14:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmlAp-0003gs-5m for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 18:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmlAo-0007NW-Rd for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 18:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mmlAo-0004yx-IS for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 18:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Nov 2021 23:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51882 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163701801319092 (code B ref -1); Mon, 15 Nov 2021 23:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Nov 2021 23:13:33 +0000 Original-Received: from localhost ([127.0.0.1]:56515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmlA9-0004xc-2I for submit@debbugs.gnu.org; Mon, 15 Nov 2021 18:13:33 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:43770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmlA2-0004xO-S2 for submit@debbugs.gnu.org; Mon, 15 Nov 2021 18:13:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmlA2-0003Q8-OA for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 18:13:14 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:42789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mml9z-0007GK-Pr for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 18:13:14 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 02ADA240028 for ; Tue, 16 Nov 2021 00:13:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1637017987; bh=qkCM2MneqmJOW3FbwilsfH6CmaoS4CAB/ZmcEiLnAoE=; h=From:To:Subject:Autocrypt:Date:From; b=NHefd27GyPz9q/4MiXzwGBFvt6rRsqAD0hgBmvXxJ+eFA91Is65P5o/myruHg1Mp1 WDGUnNFdU0G1HvMYUkiJJunsNAYuIvj5n6RFxx+0KKkaLXbQ7J0Np4gZsGlPyVkEGv /2wnwg2uaMX8zKxImeLTEL4KdJWwEP8sqz+zNCU2k70FENmQN/GsYWKjC2TSEpZ3vK AymGP/kaczIgR3DqpoS14a0sm82UrOyQYsjofyjpiPOW3Qw8TAAN9ULDHuTUZ1WRdO N6b+MTqUahNSbSaq2NBwRMNwcBEdxFHvwPT12/Pdh0kdmjiwTRFOGAicPENPqGtVmN qA3nXQ6EDAEEQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HtQ361tSRz9rxG for ; Tue, 16 Nov 2021 00:13:05 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:220087 Archived-At: --=-=-= Content-Type: text/plain Tags: patch GCC's -fanalyzer generates tree-like output, with some file references being indented like this --8<---------------cut here---------------start------------->8--- |file.c:42 --8<---------------cut here---------------end--------------->8--- M-x compile appears to assume this means the file name is " |file.c", not "file.c". The following patch would fix this behaviour. If accepted, should it be applied to emacs-28 or master? In GNU Emacs 28.0.60 (build 14, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2021-11-15 built on icterid Repository revision: e852822f3db469c985bf022651f184d6ff2c518a Repository branch: emacs-28 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Debian GNU/Linux 11 (bullseye) Configured using: 'configure --with-native-compilation --with-x-toolkit=lucid --with-imagemagick 'CFLAGS=-O2 -march=native -pipe' LDFLAGS=-flto' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Improve-error-parsing-for-GCC-fanalyzer-output.patch >From eafefd3a92789cd50c07e6fce04c1da7ea108224 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 16 Nov 2021 00:05:11 +0100 Subject: [PATCH] Improve error parsing for GCC -fanalyzer output * compile.el (compilation-error-regexp-alist-alist): Adjust gnu rule * compile-tests.el (compile-tests--test-regexps-data): Add testcase --- lisp/progmodes/compile.el | 5 ++++- test/lisp/progmodes/compile-tests.el | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ac26f5e934..ff0beacfc1 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -351,7 +351,10 @@ compilation-error-regexp-alist-alist ;; from Ruby, but it is unclear whether it is actually ;; used since the gcc-include rule above seems to cover ;; it. - (regexp "[ \t]+\\(?:in \\|from\\)"))) + (regexp "[ \t]+\\(?:in \\|from\\)") + ;; Skip indentation generated by tools like GCC's + ;; -fanalyzer. + (: (+ space) "|"))) ;; File name group. (group-n 1 diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index 2a3bb3dafa..c714b9ecfe 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -230,6 +230,7 @@ compile-tests--test-regexps-data (gnu "foo.c:8:23:information: message" 1 23 8 "foo.c") (gnu "foo.c:8.23-45: Informational: message" 1 (23 . 45) (8 . nil) "foo.c") (gnu "foo.c:8-23: message" 1 nil (8 . 23) "foo.c") + (gnu " |foo.c:8: message" 1 nil 8 "foo.c") ;; The next one is not in the GNU standards AFAICS. ;; Here we seem to interpret it as LINE1-LINE2.COL2. (gnu "foo.c:8-45.3: message" 1 (nil . 3) (8 . 45) "foo.c") -- 2.30.2 --=-=-= Content-Type: text/plain -- Philip Kaludercic --=-=-=--