robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
ab20681c52
master
1" vim compiler file 2" Compiler: cppcheck (C++ static checker) 3" Maintainer: Vincent B. (twinside@free.fr) 4" Last Change: 2025 Nov 06 by @Konfekt 5 6if exists ( "current_compiler" ) |finish |endif 7let current_compiler = "cppcheck" 8 9let s: cpo_save = & cpo 10set cpo & vim 11 12let s: slash = has ( 'win32' ) ? '\' : '/' 13 14if ! exists ( 'g:c_cppcheck_params' ) 15let g: c_cppcheck_params = '--verbose --force --inline-suppr' 16 \.. ' ' .. '--enable=warning,style,performance,portability,information,missingInclude' 17 \.. ' ' .. ( executable ( 'getconf' ) ? '-j' .. systemlist ( 'getconf _NPROCESSORS_ONLN' )[ 0 ] : '' ) 18let s: undo_compiler = 'unlet! g:c_cppcheck_params' 19endif 20 21exe 'CompilerSet makeprg=' .. escape ( 'cppcheck --quiet' 22 \.. ' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"' 23 \.. ' ' .. get ( b:, 'c_cppcheck_params' , get ( g:, 'c_cppcheck_params' , ( & filetype ==# 'cpp' ? ' --language=c++' : '' ))) 24 \.. ' ' .. get ( b:, 'c_cppcheck_includes' , get ( g:, 'c_cppcheck_includes' , 25 \( filereadable ( 'compile_commands.json' ) ? '--project=compile_commands.json' : 26 \( ! empty ( glob ( '*' .. s: slash .. 'compile_commands.json' , 1 , 1 )) ? '--project=' .. glob ( '*' .. s: slash .. 'compile_commands.json' , 1 , 1 )[ 0 ] : 27 \( empty ( & path ) ? '' : '-I' ) .. join ( map ( filter ( split ( & path , ',' ), 'isdirectory(v:val)' ), 'shellescape(v:val)' ), ' -I' ))))), 28 \' \|"' ) 29 30CompilerSet errorformat= 31 \%f:%l:%c:\ %tarning:\ %m, 32 \%f:%l:%c:\ %trror:\ %m, 33 \%f:%l:%c:\ %tnformation:\ %m, 34 \%f:%l:%c:\ %m, 35 \%.%#\ :\ [%f:%l]\ %m 36 37exe get ( s:, 'undo_compiler' , '' ) 38 39let & cpo = s: cpo_save 40unlet s: cpo_save