Ale: ALE can‘t recognize the syntax of C++17

Created on 13 May 2019  Â·  4Comments  Â·  Source: dense-analysis/ale

Information

VIM version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 13 2018 18:24:07)
Included patches: 1-279

Operating System

Linux 4.15.0-46-generic 16.04.1-Ubuntu SMP
clang version 6.0.0-1ubuntu2
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04)

What went wrong

The ALE can‘t recognize the syntax of C++17. Even if I change the config to let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++1z'

Reproducing the bug

My config as follows.

let g:ale_linters_explicit = 1
let g:airline#extensions#ale#enabled = 1
let g:ale_linters = { 'c++': ['clang', 'g++'], 'c': ['clang'] }

let g:ale_c_gcc_options = '-Wall -O2 -std=c99'
let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++1z'

let g:ale_c_clang_options = '-Wall -O2 -std=c99'
let g:ale_cpp_clang_options = '-Wall -O2 -std=c++1z'

let g:ale_c_cppcheck_options = ''
let g:ale_cpp_cppcheck_options = ''
  1. When I use the c++14, the ALE work correctly.
  2. If I use the gcc or clang to compile the code, it works fine.

    :ALEInfo

 Current Filetype: cpp
Available Linters: ['ccls', 'clang', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'flawfinder', 'gcc']
   Linter Aliases:
'gcc' -> ['g++']
  Enabled Linters: ['ccls', 'clang', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'flawfinder', 'gcc']
 Suggested Fixers:
  'clang-format' - Fix C/C++ and cuda files with clang-format.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
  'uncrustify' - Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.
 Linter Variables:

let g:ale_cpp_ccls_executable = 'ccls'
let g:ale_cpp_ccls_init_options = {}
let g:ale_cpp_clang_executable = 'clang++'
let g:ale_cpp_clang_options = '-Wall -O2 -std=c++1z'
let g:ale_cpp_clangcheck_executable = 'clang-check'
let g:ale_cpp_clangcheck_options = ''
let g:ale_cpp_clangd_executable = 'clangd'
let g:ale_cpp_clangd_options = ''
let g:ale_cpp_clangtidy_checks = []
let g:ale_cpp_clangtidy_executable = 'clang-tidy'
let g:ale_cpp_clangtidy_options = ''
let g:ale_cpp_clazy_checks = ['level1']
let g:ale_cpp_clazy_executable = 'clazy-standalone'
let g:ale_cpp_clazy_options = ''
let g:ale_cpp_cppcheck_executable = 'cppcheck'
let g:ale_cpp_cppcheck_options = ''
let g:ale_cpp_cpplint_executable = 'cpplint'
let g:ale_cpp_cpplint_options = ''
let g:ale_cpp_cquery_cache_directory = '/home/x/.cache/cquery'
let g:ale_cpp_cquery_cache_directory = '/home/x/.cache/cquery'
let g:ale_cpp_cquery_executable = 'cquery'
let g:ale_cpp_flawfinder_executable = 'flawfinder'
let g:ale_cpp_flawfinder_minlevel = 1
let g:ale_cpp_flawfinder_options = ''
let g:ale_cpp_gcc_executable = 'gcc'
let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++1z'
 Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = v:null
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 0
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'never'
let g:ale_linter_aliases = {}
let g:ale_linters = {'c': ['clang'], 'c++': ['clang', 'g++']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = v:null
let g:ale_list_window_size = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = v:null
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 0
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '✗'
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = 'âš¡ '
let g:ale_statusline_format = ['✗ %d', '⚡  %d', '✔ OK']
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1

Most helpful comment

I still have similar issues, added --std=c++17 to clang and g++ flags in .vimrc for ale, using the same flags to compile no warning issued, ALEInfo also showed no warnings, but vim still hints "Wc++17-extensions" warnings.

All 4 comments

The error is coming from clangcheck there, so you should either configure clangcheck or disable it.

let g:ale_linters = {'c': ['clang'], 'c++': ['clang', 'g++']}

That's probably your issue. Try using 'cpp' instead of 'c++'.

It works! Thx.

I still have similar issues, added --std=c++17 to clang and g++ flags in .vimrc for ale, using the same flags to compile no warning issued, ALEInfo also showed no warnings, but vim still hints "Wc++17-extensions" warnings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trevordmiller picture trevordmiller  Â·  3Comments

alexlafroscia picture alexlafroscia  Â·  4Comments

sublee picture sublee  Â·  3Comments

arthuryangcs picture arthuryangcs  Â·  4Comments

chauncey-garrett picture chauncey-garrett  Â·  3Comments