I have been trying to improve the quickfix facilities 
obtainable from gcc.   The file I have in vim7 is:
<quote>
" Vim compiler file
" Compiler:         GNU C Compiler
" Maintainer:       Nikolai Weibull <[EMAIL PROTECTED]>
" Latest Revision:  2006-04-19

if exists("current_compiler")
  finish
endif
let current_compiler = "gcc"

let s:cpo_save = &cpo
set cpo-=C

setlocal errorformat=
      \%*[^\"]\"%f\"%*\\D%l:\ %m,
      \\"%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.),
      \%f:%l:\ %m,
      \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
      \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
      \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
      \%DMaking\ %*\\a\ in\ %f

let &cpo = s:cpo_save
unlet s:cpo_save
</quote>

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',

This is being picked up correctly (I know because of introducing bugs
in it).  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 which
clearly doesn't exist.

I have tried the following forms of this line
      \%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.

        %*{conv}        any scanf non-assignable conversion

would seem to suggest I could do that.
Also I can find no examples in the supplied help or supplied compiler files,
or on the web, how to use 
<quote>
        %s              search text (finds a string)
  [...]
The "%s" conversion specifies the text to search for to locate the error line.
The text is used as a literal string.  The anchors "^" and "$" are added to
the text to locate the error line exactly matching the search text and the
text is prefixed with the "\V" atom to make it "very nomagic".  The "%s"
conversion can be used to locate lines without a line number in the error
output.  Like the output of the "grep" shell command.
When the pattern is present the line number will not be used.
</quote>

Does the string come after the %s?  Does Vim, or the author of the
errorformat add the "^" and "$", and if the latter, are they compulsory
delimiters of the string?

Is there any way to get vim to log what happens when errrorformats are 
matched, so one can debug this stuff more easily?

How should I be tacking accessing just the source file I want?

        Thank you
        Hugh

Reply via email to