Monday, November 13, 2017

Re: errorformat not parsing multi-line make (gcc) output

I was able to eliminate the escape codes in my make output by changing the -fdiagnostics-color option in gcc. So this answers my first question (the escape codes in vim's make output were caused by a gcc option that colorizes its output, and had nothing to do with vim).

I (mostly) answered my second question too. I was using this errorformat:

set errorformat =%E%f:%l:%c:\ %trror:\ %m,%-Z%p^,%+C%.%#
set errorformat+=%D%*\\a:\ Entering\ directory\ [`']%f'
set errorformat+=%X%*\\a:\ Leaving\ directory\ [`']%f'
set errorformat+=%-G%.%#

and it was correctly picking out all the multi-line error lines, and showing these in the quickfix (one line per error, as I've specified), but I could not jump to the source location. I assumed the quickfix-directory-stack was messed up, and changed the above %D and %X efm lines (which I copied from the defaults in gcc.vim) above to:

set errorformat+=%D%*\\a:\ Entering\ directory\ '%f'
set errorformat+=%X%*\\a:\ Leaving\ directory\ '%f'

This results in a sane quickfix-directory-stack, and now the quickfix window is working on all counts.

But, I must ask, is this a bug in the default patterns for parsing Entering/Leaving directories in gcc.vim? Why is it using [`']%f' instead of '%f'?

On Monday, November 13, 2017 at 1:39:30 PM UTC-8, Tim Black wrote:
> It appears this might not be a vim issue after all, as I'm also seeing these characters when I redirect stdout + stderr from my make command to a file.
>
> For anyone looking here for help on troubleshooting multiline errorformat, this question has a very helpful response:
>
> https://stackoverflow.com/questions/16718444/multiline-errorformat-in-vim
>
> On Monday, November 13, 2017 at 12:54:12 PM UTC-8, Tim Black wrote:
> > I'm struggling to get vim (8.0 (2016 Sep 12)) to parse the output of my build system, and need help with defining my errorformat. The default gcc efm appears to not be matching any lines, so in quickfix I see basically every line of make output, but the lines that actually contain errors show up with odd characters inserted.
> >
> > Example make output:
> >
> > make: Entering directory '/home/tblack/SourceRAM/la/Blocks'
> > ZYNQ_GPP src/avpcva.cpp
> > src/avpcva.cpp: In destructor 'virtual Blocks::AVPCVA::~AVPCVA()':
> > src/avpcva.cpp:152:49: error: 'class AVBC::STC' has no member named 'getHandle'
> > uint16_t handle = stIter->second->getHandle();
> > ^
> >
> > For the above make output, the quickfix list shows:
> >
> > || make: Entering directory '/home/tblack/SourceRAM/la/Blocks'
> > || ZYNQ_GPP src/avpcva.cpp
> > || ^[[01m^[[Ksrc/avpcva.cpp:^[[m^[[K In destructor '^[[01m^[[Kvirtual Blocks::AVPCVA::~AVPCVA()^[[m^[[K':
> > || ^[[01m^[[Ksrc/avpcva.cpp:152:49:^[[m^[[K ^[[01;31m^[[Kerror: ^[[m^[[K'^[[01m^[[Kclass AVBC::STC^[[m^[[K' has no member named '^[[01m^[[Kget Handle^[[m^[[K'
> > || uint16_t handle = stIter->second->getHandle();
> > || ^[[01;32m^[[K ^^[[m^[[K
> >
> > The default errorformat for vim's gcc compiler plugin (amazingly) does not appear to beconfigured to support multi-line output (doesn't include any of %E, %C, %Z). I suspect that I just need to adjust my errorformat accordingly, but:
> >
> > 1. Would my using the default efm explain the odd characters in my quickfix?
> > 2. I could use help with the specification of an efm that will correctly parse my make output. I have been reading the vim docs and browsing the web for days and still not making headway on demystifying and troubleshooting multiline errorformats in vim.
> >
> > I took a stab at this, using the errorformat below. The first line attempts to define my multi-line error format start(%E)/continue(%C)/end(%Z).
> >
> > set errorformat =%E%f:%l:%c:\ %trror:\ %m,%-C,%-Z%p^
> > set errorformat+=%D%*\\a:\ Entering\ directory\ [`']%f'
> > set errorformat+=%X%*\\a:\ Leaving\ directory\ [`']%f'
> >
> > But it does not result in any different behavior from what I described above.
> >
> > Thank you.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment