From: "Mattias Engdegård" <mattiase@acm.org>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 39595@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
Paul Pogonyshev <pogonyshev@gmail.com>
Subject: bug#39595: #39595: M-x compile still very line-length weak
Date: Sun, 16 Feb 2020 13:15:09 +0100 [thread overview]
Message-ID: <D6995D57-6E4D-41EA-BC3F-6FF5360259B2@acm.org> (raw)
In-Reply-To: <E4BC9D74-6DDC-4741-8694-E84D97724354@acm.org>
[-- Attachment #1: Type: text/plain, Size: 159 bytes --]
To wrap it up, here are the three patches (intended to be used together). The Maven patch was tweaked further for efficiency.
Dan, is this satisfactory?
[-- Attachment #2: 0001-Speed-up-maven-compilation-error-message-regexp.patch --]
[-- Type: application/octet-stream, Size: 3566 bytes --]
From 1a5a9ac17e227f32608dd6fe2c040ebd87cf3602 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Fri, 14 Feb 2020 21:26:20 +0100
Subject: [PATCH 1/3] Speed up 'maven' compilation error message regexp
Anchor the regexp at line-start to prevent quadratic behaviour when
it doesn't match (bug#39595). It's unclear whether the type tag, like
[ERROR], is always present; we keep it optional just in case.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Rewrite 'maven' regexp, using rx for clarity.
* etc/compilation.txt (maven): More examples.
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data): No leading spaces; they seems to
stem from a misunderstanding in bug#11517.
---
etc/compilation.txt | 2 ++
lisp/progmodes/compile.el | 20 ++++++++++++++++----
test/lisp/progmodes/compile-tests.el | 2 +-
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/etc/compilation.txt b/etc/compilation.txt
index a597216daa..c465b4b94a 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -341,6 +341,8 @@ makepp: bla bla `/foo/bar.c' and `/foo/bar.h'
symbol: maven
FooBar.java:[111,53] no interface expected here
+[ERROR] /Users/cinsk/hello.java:[651,96] ';' expected
+[WARNING] /foo/bar/Test.java:[27,43] unchecked conversion
* MIPS lint; looks good for SunPro lint also
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 48ac85a73b..9959c829df 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -268,12 +268,24 @@ compilation-error-regexp-alist-alist
(jikes-file
"^\\(?:Found\\|Issued\\) .* compiling \"\\(.+\\)\":$" 1 nil nil 0)
-
- ;; This used to be pathologically slow on long lines (Bug#3441),
- ;; due to matching filenames via \\(.*?\\). This might be faster.
(maven
;; Maven is a popular free software build tool for Java.
- "\\(\\[WARNING\\] *\\)?\\([^ \n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\] " 2 3 4 (1))
+ ,(rx bol
+ ;; It is unclear whether the initial [type] tag is always present.
+ (? "["
+ (or "ERROR" (group-n 1 "WARNING") (group-n 2 "INFO"))
+ "] ")
+ (group-n 3 ; File
+ (not (any "\n ["))
+ (* (or (not (any "\n :"))
+ (: " " (not (any "\n/-")))
+ (: ":" (not (any "\n ["))))))
+ ":["
+ (group-n 4 (+ digit)) ; Line
+ ","
+ (group-n 5 (+ digit)) ; Column
+ "] ")
+ 3 4 5 (1 . 2))
(jikes-line
"^ *\\([0-9]+\\)\\.[ \t]+.*\n +\\(<-*>\n\\*\\*\\* \\(?:Error\\|Warnin\\(g\\)\\)\\)"
diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el
index 350b4eb400..c3cec01f8b 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -242,7 +242,7 @@ compile-tests--test-regexps-data
;; maven
("FooBar.java:[111,53] no interface expected here"
1 53 111 "FooBar.java" 2)
- (" [ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
+ ("[ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
15 96 651 "/Users/cinsk/hello.java" 2) ;Bug#11517.
("[WARNING] /foo/bar/Test.java:[27,43] unchecked conversion"
11 43 27 "/foo/bar/Test.java" 1) ;Bug#20556
--
2.21.1 (Apple Git-122.3)
[-- Attachment #3: 0002-Speed-up-msft-and-watcom-compilation-error-regexps.patch --]
[-- Type: application/octet-stream, Size: 1705 bytes --]
From 8689105a957e70c127d2f39ea8e4c0fcc141e2a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Fri, 14 Feb 2020 23:38:24 +0100
Subject: [PATCH 2/3] Speed up 'msft' and 'watcom' compilation error regexps
They have similar structure, and both suffer from being able to
match leading spaces in multiple ways which leads to bad performance
when backtracking (bug#39595).
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Improved 'msft' and 'watcom' regexps.
---
lisp/progmodes/compile.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 9959c829df..21c3153b8a 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -221,7 +221,7 @@ compilation-error-regexp-alist-alist
;; considered before EDG.
;; The message may be a "warning", "error", or "fatal error" with
;; an error code, or "see declaration of" without an error code.
- "^ *\\([0-9]+>\\)?\\(\\(?:[a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) ?\
+ "^ *\\([0-9]+>\\)?\\(\\(?:[a-zA-Z]:\\)?[^ :(\t\n][^:(\t\n]*\\)(\\([0-9]+\\)) ?\
: \\(?:see declaration\\|\\(?:warnin\\(g\\)\\|[a-z ]+\\) C[0-9]+:\\)"
2 3 nil (4))
@@ -455,7 +455,7 @@ compilation-error-regexp-alist-alist
"^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., (-]" 1 2 3)
(watcom
- "^[ \t]*\\(\\(?:[a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)): ?\
+ "^[ \t]*\\(\\(?:[a-zA-Z]:\\)?[^ :(\t\n][^:(\t\n]*\\)(\\([0-9]+\\)): ?\
\\(?:\\(Error! E[0-9]+\\)\\|\\(Warning! W[0-9]+\\)\\):"
1 2 nil (4))
--
2.21.1 (Apple Git-122.3)
[-- Attachment #4: 0003-Make-OMake-support-slightly-less-expensive-bug-39595.patch --]
[-- Type: application/octet-stream, Size: 4602 bytes --]
From aa5b0aa200a5c045a89dd8e349de34a128f3c9c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Sat, 15 Feb 2020 16:08:14 +0100
Subject: [PATCH 3/3] Make OMake support slightly less expensive (bug#39595)
When run with -p or -P, OMake regurgitates error messages that
prevented further progress, indented by 6 spaces. Use that fact
to ameliorate the modification done to other error message regexps.
* lisp/progmodes/compile.el (compilation-parse-errors):
When 'omake' is enabled, allow error messages to be indented by 0 or 6
spaces instead of any number of spaces, to avoid pathological
behaviour.
(compilation-error-regexp-alist-alist): Anchor the 'omake' pattern to
bol for performance. Repair the 'ruby-Test::Unit' pattern, which
relied on the previously over-generous 'omake' hack.
* etc/compilation.txt (OMake): Add examples.
* test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data)
(compile-test-error-regexps): Add test for OMake (indented error).
---
etc/compilation.txt | 16 ++++++++++++++++
lisp/progmodes/compile.el | 6 +++---
test/lisp/progmodes/compile-tests.el | 5 ++++-
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/etc/compilation.txt b/etc/compilation.txt
index c465b4b94a..ebce6a14d0 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -384,6 +384,22 @@ symbol: watcom
..\src\ctrl\lister.c(120): Warning! W201: Unreachable code
+* OMake
+
+symbol: omake
+
+When using in -p or -P mode, OMake will detect changes to files and
+report critical build errors indented by 6 spaces.
+
+*** omake: file alpha.c changed
+*** omake: targets were not rebuilt because of errors:
+ alpha.o
+ depends on: alpha.c
+ - build . alpha.o
+ + cc -I. -c -o alpha.o alpha.c
+ alpha.c:5:15: error: expected ';' after expression
+
+
* Oracle pro*c
symbol: oracle
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 21c3153b8a..455f181f50 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -306,7 +306,7 @@ compilation-error-regexp-alist-alist
1 2 3 (4 . 5))
(ruby-Test::Unit
- "^[\t ]*\\[\\([^(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2)
+ "^ [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2)
(gmake
;; Set GNU make error messages as INFO level.
@@ -406,7 +406,7 @@ compilation-error-regexp-alist-alist
(omake
;; "omake -P" reports "file foo changed"
;; (useful if you do "cvs up" and want to see what has changed)
- "omake: file \\(.*\\) changed" 1 nil nil nil nil
+ "^\\*\\*\\* omake: file \\(.*\\) changed" 1 nil nil nil nil
;; FIXME-omake: This tries to prevent reusing pre-existing markers
;; for subsequent messages, since those messages's line numbers
;; are about another version of the file.
@@ -1453,7 +1453,7 @@ compilation-parse-errors
((not (memq 'omake compilation-error-regexp-alist)) nil)
((string-match "\\`\\([^^]\\|\\^\\( \\*\\|\\[\\)\\)" pat)
nil) ;; Not anchored or anchored but already allows empty spaces.
- (t (setq pat (concat "^ *" (substring pat 1)))))
+ (t (setq pat (concat "^\\(?: \\)?" (substring pat 1)))))
(if (consp file) (setq fmt (cdr file) file (car file)))
(if (consp line) (setq end-line (cdr line) line (car line)))
diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el
index c3cec01f8b..75962566f1 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -269,6 +269,9 @@ compile-tests--test-regexps-data
1 nil 109 "..\\src\\ctrl\\lister.c")
("..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code"
1 nil 120 "..\\src\\ctrl\\lister.c")
+ ;; omake
+ (" alpha.c:5:15: error: expected ';' after expression"
+ 1 15 5 "alpha.c")
;; oracle
("Semantic error at line 528, column 5, file erosacqdb.pc:"
1 5 528 "erosacqdb.pc")
@@ -428,7 +431,7 @@ compile-test-error-regexps
(compilation-num-warnings-found 0)
(compilation-num-infos-found 0))
(mapc #'compile--test-error-line compile-tests--test-regexps-data)
- (should (eq compilation-num-errors-found 92))
+ (should (eq compilation-num-errors-found 93))
(should (eq compilation-num-warnings-found 36))
(should (eq compilation-num-infos-found 26)))))
--
2.21.1 (Apple Git-122.3)
[-- Attachment #5: Type: text/plain, Size: 2 bytes --]
next prev parent reply other threads:[~2020-02-16 12:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 5:51 bug#39595: M-x compile still very line-length weak 積丹尼 Dan Jacobson
2020-02-14 11:18 ` bug#39595: #39595: " Mattias Engdegård
2020-02-14 16:27 ` Mattias Engdegård
2020-02-14 17:00 ` Eli Zaretskii
2020-02-14 22:47 ` Mattias Engdegård
2020-02-15 7:35 ` Eli Zaretskii
2020-02-15 16:45 ` Mattias Engdegård
2020-02-16 12:15 ` Mattias Engdegård [this message]
2020-02-15 1:28 ` 積丹尼 Dan Jacobson
2020-02-15 13:57 ` Stefan Monnier
2020-02-16 15:37 ` 積丹尼 Dan Jacobson
2020-02-17 11:07 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D6995D57-6E4D-41EA-BC3F-6FF5360259B2@acm.org \
--to=mattiase@acm.org \
--cc=39595@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=monnier@iro.umontreal.ca \
--cc=pogonyshev@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).