1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 19:30:38 -08:00

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).
This commit is contained in:
Mattias Engdegård 2020-02-15 16:08:14 +01:00
parent 39410cfc5a
commit f765aad28b
3 changed files with 23 additions and 4 deletions

View file

@ -384,6 +384,22 @@ symbol: watcom
..\src\ctrl\lister.c(120): Warning! W201: Unreachable code ..\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 * Oracle pro*c
symbol: oracle symbol: oracle

View file

@ -306,7 +306,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
1 2 3 (4 . 5)) 1 2 3 (4 . 5))
(ruby-Test::Unit (ruby-Test::Unit
"^[\t ]*\\[\\([^(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2) "^ [[ ]?\\([^ (].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2)
(gmake (gmake
;; Set GNU make error messages as INFO level. ;; Set GNU make error messages as INFO level.
@ -406,7 +406,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
(omake (omake
;; "omake -P" reports "file foo changed" ;; "omake -P" reports "file foo changed"
;; (useful if you do "cvs up" and want to see what has 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 ;; FIXME-omake: This tries to prevent reusing pre-existing markers
;; for subsequent messages, since those messages's line numbers ;; for subsequent messages, since those messages's line numbers
;; are about another version of the file. ;; are about another version of the file.
@ -1453,7 +1453,7 @@ to `compilation-error-regexp-alist' if RULES is nil."
((not (memq 'omake compilation-error-regexp-alist)) nil) ((not (memq 'omake compilation-error-regexp-alist)) nil)
((string-match "\\`\\([^^]\\|\\^\\( \\*\\|\\[\\)\\)" pat) ((string-match "\\`\\([^^]\\|\\^\\( \\*\\|\\[\\)\\)" pat)
nil) ;; Not anchored or anchored but already allows empty spaces. 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 file) (setq fmt (cdr file) file (car file)))
(if (consp line) (setq end-line (cdr line) line (car line))) (if (consp line) (setq end-line (cdr line) line (car line)))

View file

@ -269,6 +269,9 @@
1 nil 109 "..\\src\\ctrl\\lister.c") 1 nil 109 "..\\src\\ctrl\\lister.c")
("..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code" ("..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code"
1 nil 120 "..\\src\\ctrl\\lister.c") 1 nil 120 "..\\src\\ctrl\\lister.c")
;; omake
(" alpha.c:5:15: error: expected ';' after expression"
1 15 5 "alpha.c")
;; oracle ;; oracle
("Semantic error at line 528, column 5, file erosacqdb.pc:" ("Semantic error at line 528, column 5, file erosacqdb.pc:"
1 5 528 "erosacqdb.pc") 1 5 528 "erosacqdb.pc")
@ -428,7 +431,7 @@ The test data is in `compile-tests--test-regexps-data'."
(compilation-num-warnings-found 0) (compilation-num-warnings-found 0)
(compilation-num-infos-found 0)) (compilation-num-infos-found 0))
(mapc #'compile--test-error-line compile-tests--test-regexps-data) (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-warnings-found 36))
(should (eq compilation-num-infos-found 26))))) (should (eq compilation-num-infos-found 26)))))