all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: 51882@debbugs.gnu.org
Subject: bug#51882: Handle GCC's -fanalyzer output in M-x compile
Date: Mon, 15 Nov 2021 23:13:05 +0000	[thread overview]
Message-ID: <87ee7hm2ri.fsf@posteo.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-error-parsing-for-GCC-fanalyzer-output.patch --]
[-- Type: text/patch, Size: 1868 bytes --]

From eafefd3a92789cd50c07e6fce04c1da7ea108224 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
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


[-- Attachment #3: Type: text/plain, Size: 24 bytes --]


-- 
	Philip Kaludercic

             reply	other threads:[~2021-11-15 23:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 23:13 Philip Kaludercic [this message]
2021-11-16  8:13 ` bug#51882: Handle GCC's -fanalyzer output in M-x compile Lars Ingebrigtsen
2021-11-16 10:28 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-17 20:21   ` Philip Kaludercic
2021-11-23 15:35 ` Mattias Engdegård
2021-11-23 18:14   ` Philip Kaludercic
2021-11-23 20:03     ` Mattias Engdegård
2021-11-25  9:24     ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee7hm2ri.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=51882@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.