From 4def389ae43895121d120dfa56a0019acc0b9ad2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 8 Feb 2014 09:32:44 +0200 Subject: [PATCH] Cleanup: asm/gcc checker. --- README.markdown | 8 ++++---- syntax_checkers/asm/gcc.vim | 33 +++++++++------------------------ 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/README.markdown b/README.markdown index f939bd7e..04effa59 100644 --- a/README.markdown +++ b/README.markdown @@ -35,10 +35,10 @@ the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, -Ada, AppleScript, AsciiDoc, BEMHTML, Bourne shell, C, C++, C#, Chef, -CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, -Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, -Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, +Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef, +CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, +Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, +Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, diff --git a/syntax_checkers/asm/gcc.vim b/syntax_checkers/asm/gcc.vim index 55626b0d..f5ecebe6 100644 --- a/syntax_checkers/asm/gcc.vim +++ b/syntax_checkers/asm/gcc.vim @@ -15,53 +15,38 @@ if exists('g:loaded_syntastic_asm_gcc_checker') endif let g:loaded_syntastic_asm_gcc_checker = 1 -let s:asm_extensions = { - \ 's': 'att', - \ 'asm': 'intel' - \ } - -if !exists('g:syntastic_asm_compiler') - let g:syntastic_asm_compiler = 'gcc' +if !exists('g:syntastic_asm_compiler_options') + let g:syntastic_asm_compiler_options = '' endif let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_asm_gcc_IsAvailable() dict + if !exists('g:syntastic_asm_compiler') + let g:syntastic_asm_compiler = self.getExec() + endif return executable(expand(g:syntastic_asm_compiler)) endfunction -if !exists('g:syntastic_asm_options') - let g:syntastic_asm_options = '' -endif - function! SyntaxCheckers_asm_gcc_GetLocList() dict - let compiler_options = s:GetDialect() . ' ' . g:syntastic_asm_options - return syntastic#c#GetLocList('asm', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%f:%l: %m', - \ 'main_flags': '-x assembler -fsyntax-only -masm=' . compiler_options , }) + \ 'main_flags': '-x assembler -fsyntax-only -masm=' . s:GetDialect() }) endfunction function! s:GetDialect() - if exists('g:syntastic_asm_dialect') - return g:syntastic_asm_dialect - endif - - let extensions = exists('g:syntastic_asm_extensions') - \ ? g:syntastic_asm_extensions : s:asm_extensions - let dialect = get( extensions, tolower(expand('%:e')), 'att' ) - - return dialect + return exists('g:syntastic_asm_dialect') ? g:syntastic_asm_dialect : + \ expand('%:e') ==? 'asm' ? 'intel' : 'att' endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'asm', - \ 'name': 'gcc'}) + \ 'name': 'gcc' }) let &cpo = s:save_cpo unlet s:save_cpo