mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
cc: use '-x c*-header' for header files for C and C++ linters. (#4318)
When linting an header file in C or C++, `-x c-header` or `-x c++-header` should be used instead of `-x c` or `-x c++`. Using `-x c` or `-x c++` for headers files can lead to unused variables and functions marked as static inlined as seen in #4096. Using `-x c-header` or `-x c++-header` solve these issues. The list of file extensions that are considered as header files can be configured with the variables `g:ale_c_cc_header_exts` and `g:ale_cpp_cc_header_exts`.
This commit is contained in:
@@ -136,6 +136,17 @@ g:ale_c_cc_options *g:ale_c_cc_options*
|
||||
This variable can be change to modify flags given to the C compiler.
|
||||
|
||||
|
||||
g:ale_c_cc_header_exts *g:ale_c_cc_header_exts*
|
||||
*b:ale_c_cc_header_exts*
|
||||
Type: |List|
|
||||
Default: `['h']`
|
||||
|
||||
This variable can be change to modify the list of extensions of the files
|
||||
considered as header files.
|
||||
|
||||
ALE will use `'-x c-header'` instead of `'-x c'` for header files.
|
||||
|
||||
|
||||
===============================================================================
|
||||
ccls *ale-c-ccls*
|
||||
|
||||
|
||||
@@ -65,6 +65,17 @@ g:ale_cpp_cc_options *g:ale_cpp_cc_options*
|
||||
This variable can be change to modify flags given to the C++ compiler.
|
||||
|
||||
|
||||
g:ale_cpp_cc_header_exts *g:ale_cpp_cc_header_exts*
|
||||
*b:ale_cpp_cc_header_exts*
|
||||
Type: |List|
|
||||
Default: `['h', 'hpp']`
|
||||
|
||||
This variable can be change to modify the list of extensions of the files
|
||||
considered as header files.
|
||||
|
||||
ALE will use `'-x c++-header'` instead of `'-x c++'` for header files.
|
||||
|
||||
|
||||
===============================================================================
|
||||
ccls *ale-cpp-ccls*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user