diff --git a/README.md b/README.md index dde20d0d..9eb16fd0 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ name. That seems to be the fairest way to arrange this table. | Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) | | Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) | | Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) | -| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)| +| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)| | C++ (filetype cpp) | [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)| | CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) | | CSS | [csslint](http://csslint.net/) | diff --git a/ale_linters/c/clang.vim b/ale_linters/c/clang.vim new file mode 100644 index 00000000..205dd922 --- /dev/null +++ b/ale_linters/c/clang.vim @@ -0,0 +1,20 @@ +" Author: Masahiro H https://github.com/mshr-h +" Description: clang linter for c files + +" Set this option to change the Clang options for warnings for C. +if !exists('g:ale_c_clang_options') + " let g:ale_c_clang_options = '-Wall' + " let g:ale_c_clang_options = '-std=c99 -Wall' + " c11 compatible + let g:ale_c_clang_options = '-std=c11 -Wall' +endif + +call ale#linter#Define('c', { +\ 'name': 'clang', +\ 'output_stream': 'stderr', +\ 'executable': 'clang', +\ 'command': 'clang -S -x c -fsyntax-only ' +\ . g:ale_c_clang_options +\ . ' -', +\ 'callback': 'ale#handlers#HandleGCCFormat', +\}) diff --git a/doc/ale.txt b/doc/ale.txt index 3420b5a3..8025f776 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -55,7 +55,7 @@ The following languages and tools are supported. * Ansible: 'ansible-lint' * Bash: 'shell' (-n flag), 'shellcheck' * Bourne Shell: 'shell' (-n flag), 'shellcheck' -* C: 'cppcheck', 'gcc' +* C: 'cppcheck', 'gcc', 'clang' * C++ (filetype cpp): 'cppcheck', 'gcc' * CoffeeScript: 'coffee', 'coffelint' * CSS: 'csslint' @@ -561,6 +561,17 @@ g:ale_html_htmlhint_options *g:ale_html_htmlhint_options This variable can be changed to modify flags given to HTMLHint. +------------------------------------------------------------------------------- +4.5. c-gcc *ale-linter-options-c-clang* + +g:ale_c_clang_options *g:ale_c_clang_options* + + Type: |String| + Default: `'-std=c11 -Wall'` + + This variable can be change to modify flags given to clang. + + =============================================================================== 5. Commands/Keybinds *ale-commands*