diff options
author | w0rp <w0rp@users.noreply.github.com> | 2016-10-31 10:58:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 10:58:40 +0000 |
commit | f44756f347611122b4e8c4dcc379e4ac3adb30d3 (patch) | |
tree | 05dea04e989517ef1dd702cac2ec887b2af9de87 | |
parent | 9028d1f1322bdec9c6f6fdf886affb9201c44b34 (diff) | |
parent | e3a8829d678927ee75d937a3651d51d674ac16e7 (diff) | |
download | ale-f44756f347611122b4e8c4dcc379e4ac3adb30d3.zip |
Merge pull request #158 from mshr-h/support-clang-for-c
Add support for clang for C language
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | ale_linters/c/clang.vim | 20 | ||||
-rw-r--r-- | doc/ale.txt | 13 |
3 files changed, 33 insertions, 2 deletions
@@ -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* |