On 2006-11-27, Hugh Sasse <[EMAIL PROTECTED]> wrote:
> I have been trying to improve the quickfix facilities
> obtainable from gcc and I have modified it thusly:
>
> --- /usr/local/share/vim/vim70/compiler/gcc.vim 2006-07-19
> 18:11:22.117752000 +0100
> +++ /home/hgs/.vim/compiler/gcc.vim 2006-11-22 18:33:39.269332000 +0000
> @@ -16,6 +16,8 @@
> \\"%f\"%*\\D%l:\ %m,
> \%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\
> only\ once,
> \%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.),
> + \%E%f:%l:\ multiple\ definitions\ of\ %m,
> + \%Z%*\\s:%f:%l:\ first\ defined\ here,
> \%f:%l:\ %m,
> \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
> \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
>
> But when I get results like:
>
> /home/hgs/fsv/rawimage.c:97: multiple definition of `image_check_is_png'
> image.o:/home/hgs/fsv/image.c:97: first defined here
>
> vim tries to pickup a file called image.o:/home/hgs/fsv/image.c
> for the second line (:cn) which clearly doesn't exist.
>
> I have tried the following forms of this second line in order to modify
> what is detected before the %f :-
>
> \%Z%*\\s:%f:%l:\ first\ defined\ here,
> \%Z%.%#:%f:%l:\ first\ defined\ here,
> \%Z%*[^:]:%f:%l:\ first\ defined\ here,
> \%Z%m:%f:%l:\ first\ defined\ here,
> \%Z%*f:%f:%l:\ first\ defined\ here,
>
> The latter of which complains about 2 %f symbols in the line, despite the
> first having a * in it.
>
> How do I NOT pickup the object file before the ":%f:\ first\ defined\ here"?
As it says in
:help efm-entries
when 'errorformat' contains several patterns, the first pattern that
has a complete match is used. So if the problem is that the leading
"image.o:" is being picked up as a file name, I would create a
pattern that begins
^\k\+\.o:%f
(or whatever the correct syntax is) so that the leading "image.o:"
or any basename followed by ".o:" is matched as just text. Then if
necessary, follow that pattern with a pattern that matches a line
without the leading "image.o:".
Note that the syntax of my example pattern is probably _not_
correct--it's been a while since I wrote an 'errorformat' pattern
and I didn't check the syntax rules just now.
The idea is, rather than try to use one pattern that matches every
form of the line, use several patterns, each one of which matches
some form of the line, with more restrictive patterns followed by
less restrictive patterns.
HTH,
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
| Spokane, Washington, USA