diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-29 20:00:29 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-29 20:00:42 +0100 |
commit | 2c7d14809d5e143af89317461daadd12408bfbd5 (patch) | |
tree | 5731835343d05eb8ddd539c4f41aae1ac21a5f0b /ale_linters | |
parent | dfb10f1db2d2aaacf6c1bcc6fe69223398a46420 (diff) | |
download | ale-2c7d14809d5e143af89317461daadd12408bfbd5.zip |
Set GCC flags appropriately for older versions
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/cpp/gcc.vim | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim index 9e8f859d..19de0c9c 100644 --- a/ale_linters/cpp/gcc.vim +++ b/ale_linters/cpp/gcc.vim @@ -3,16 +3,17 @@ " Set this option to change the GCC options for warnings for C. if !exists('g:ale_cpp_gcc_options') - " added c++14 standard support - " POSIX thread and standard c++ thread and atomic library Linker - " let g:ale_cpp_gcc_options = '-std=c++1z' for c++17 - " for previous version and default, you can just use - " let g:ale_cpp_gcc_options = '-Wall' - " for more see man pages of gcc - " $ man g++ - " make sure g++ in your $PATH - " Add flags according to your requirements - let g:ale_cpp_gcc_options = '-std=c++14 -Wall' + let s:version = ale#handlers#gcc#ParseGCCVersion(systemlist('gcc --version')) + + if !empty(s:version) && ale#semver#GreaterOrEqual(s:version, [4, 9, 0]) + " Use c++14 support in 4.9 and above. + let g:ale_cpp_gcc_options = '-std=c++14 -Wall' + else + " Use c++1y in older versions. + let g:ale_cpp_gcc_options = '-std=c++1y -Wall' + endif + + unlet! s:version endif function! ale_linters#cpp#gcc#GetCommand(buffer) abort |