Subject: bug#6778: 24.0.50; compile-mode fails on gcc-4.5 error messages

From: Dan Nicolaescu <[email-masked]>
Date: Thu, 05 Aug 2010 00:44:58 -0400

Miles Bader <[email-masked]> writes:

> Emacs compile.el fails to parse correctly gcc 4.5 error messages that
> include a column as well as a line number.
>
> To reproduce, assuming gcc 4.5 is installed as "gcc-4.5":
>
> (1) Put the following text into a file "x.c":
>
>       int y = 1;
>       int z = q1;
>       int p = 1;
>
> (2) Now compile by doing "M-x compile", and for a compilation command,
>     use "gcc-4.5 -c x.c".
>
> (3) The compiler will output an error message like:
>
>       -*- mode: compilation; default-directory: "/tmp/" -*-
>       Compilation started at Mon Aug  2 23:07:40
>
>       gcc-4.5 -c x.c
>       x.c:2:12: error: ‘q1’ undeclared here (not in a function)
>
>       Compilation exited abnormally with code 1 at Mon Aug  2 23:07:40
>
> (4) One should be able to jump to the error by giving the command
>     `next-error' ("C-x `"); however next-error apparently is confused
>     by the error, and instead gives a prompt like:
>
>        Find this error in (default x.c:2): /tmp/
>
>
> Apparently it fails to recognize the FILE:LINE:COL: format, and thinks
> that ":2" is part of the filename.
>
> My recollection is that such error messages used to be properly parsed
> by next-error, so maybe some recent change has broken this.

Indeed.  The bug was introduced by this change:

2010-07-10  Aleksei Gusev  <[email-masked]>  (tiny change)

      * progmodes/compile.el (compilation-error-regexp-alist-alist): Add
         regexps for cucumber and ruby.