Subject: bug#8866: 23.3.50; flymake-mode colors warnings as errors

From: Glenn Morris <[email-masked]>
Date: Wed, 15 Jun 2011 03:28:17 -0400

Reuben Thomas wrote:

> In emacs -Q, I visit a C file, M-x flymake-mode, and introduce a
> warning-inducing problem. The background of the line goes pink, which is
> the error face, not the warning face.

Crystal ball says:

You are using gcc 4.5 or later. Your warnings look like:

go.c:4:4: warning: 'a' is used uninitialized in this function

rather than:

go.c:4: warning: 'a' is used uninitialized in this function

Ie, they include a column number.

Due to the silly way this works, patching the "ant/javac" regexp in
flymake.el may fix this:

*** lisp/progmodes/flymake.el	2011-01-02 23:50:46 +0000
--- lisp/progmodes/flymake.el	2011-06-15 07:28:54 +0000
***************
*** 918,925 ****
       ;; PHP
       ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)
       ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
!      ;; ant/javac
!      (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)"
        2 4 nil 5))
     ;; compilation-error-regexp-alist)
     (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))
--- 918,925 ----
       ;; PHP
       ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)
       ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
!      ;; ant/javac.  Note this also matches gcc warnings!
!      (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\\(?:\:[0-9]+\\)?\:[ \t\n]*\\(.+\\)"
        2 4 nil 5))
     ;; compilation-error-regexp-alist)
     (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))