From aaacd75d21ed3c34e63ae435190fe5baa6f62c04 Mon Sep 17 00:00:00 2001 From: Yuri Bochkarev Date: Wed, 4 Jul 2012 11:51:08 +0400 Subject: [PATCH 1/3] Let user configure errorformat string in c/cpp syntax checkers. --- syntax_checkers/c.vim | 7 +++++++ syntax_checkers/cpp.vim | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index a2cedfb5..2965a944 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -58,6 +58,9 @@ " setting are removed from the result set: " " let g:syntastic_c_remove_include_errors = 1 +" +" Use variable 'g:syntastic_c_errorformat' to set custom error format string: +" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m' if exists('loaded_c_syntax_checker') finish @@ -86,6 +89,10 @@ function! SyntaxCheckers_c_GetLocList() \ 'each function it appears%.%#,%-GIn file included%.%#,'. \ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m' + if exists('g:syntastic_c_errorformat') + let errorformat = g:syntastic_c_errorformat + endif + " add optional user-defined compiler options let makeprg .= g:syntastic_c_compiler_options diff --git a/syntax_checkers/cpp.vim b/syntax_checkers/cpp.vim index 16bebde3..d54c3d4d 100644 --- a/syntax_checkers/cpp.vim +++ b/syntax_checkers/cpp.vim @@ -58,6 +58,9 @@ " g:syntastic_cpp_include_dirs' setting are removed from the result set: " " let g:syntastic_cpp_remove_include_errors = 1 +" +" Use variable 'g:syntastic_cpp_errorformat' to set custom error format string: +" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m' if exists('loaded_cpp_syntax_checker') finish @@ -79,6 +82,10 @@ function! SyntaxCheckers_cpp_GetLocList() let makeprg = 'g++ -fsyntax-only ' let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' + if exists('g:syntastic_cpp_errorformat') + let errorformat = g:syntastic_cpp_errorformat + endif + if exists('g:syntastic_cpp_compiler_options') let makeprg .= g:syntastic_cpp_compiler_options endif From 2f69e0b7570b51a0a270549c8d53a5e30e4b1841 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 6 Jul 2012 00:54:40 +0200 Subject: [PATCH 2/3] extend C errorformat --- syntax_checkers/c.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index 2965a944..55b06de8 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -59,7 +59,9 @@ " " let g:syntastic_c_remove_include_errors = 1 " -" Use variable 'g:syntastic_c_errorformat' to set custom error format string: +" Use the variable 'g:syntastic_c_errorformat' to override the default error +" format: +" " let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m' if exists('loaded_c_syntax_checker') @@ -87,7 +89,9 @@ function! SyntaxCheckers_c_GetLocList() let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. \ 'each function it appears%.%#,%-GIn file included%.%#,'. - \ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m' + \ '%-G %#from %f:%l\,,%f:%l:%c: %trror: %m,%f:%l:%c: '. + \ '%tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,'. + \ '%f:%l: %tarning: %m,%f:%l: %m' if exists('g:syntastic_c_errorformat') let errorformat = g:syntastic_c_errorformat From 341d87816bd446e16ad6de157528774f83291348 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 6 Jul 2012 00:54:55 +0200 Subject: [PATCH 3/3] improve C++ errorformat as well --- syntax_checkers/cpp.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/cpp.vim b/syntax_checkers/cpp.vim index d54c3d4d..4a0a9b0a 100644 --- a/syntax_checkers/cpp.vim +++ b/syntax_checkers/cpp.vim @@ -59,7 +59,9 @@ " " let g:syntastic_cpp_remove_include_errors = 1 " -" Use variable 'g:syntastic_cpp_errorformat' to set custom error format string: +" Use the variable 'g:syntastic_cpp_errorformat' to override the default error +" format: +" " let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m' if exists('loaded_cpp_syntax_checker') @@ -80,7 +82,9 @@ endif function! SyntaxCheckers_cpp_GetLocList() let makeprg = 'g++ -fsyntax-only ' - let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' + let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '. + \ '%m,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %tarning: %m,'. + \ '%f:%l: %m' if exists('g:syntastic_cpp_errorformat') let errorformat = g:syntastic_cpp_errorformat