Linting C/C++ headers - unused variables, non-declared, wrong types... #4090
Unanswered
JuanClBl
asked this question in
Q&A - Ask for help with problems
Replies: 1 comment 1 reply
-
Figuring out where C header files are for projects is the most difficult thing. There are no standards for C project directories, so they could be anywhere. The best thing to do is open an issue which shows how your project is structured and people can update ALE to make better guesses based on that, or at least point out what options to set so |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been struggling for a while trying to find out how to make ALE not to mark variables in C headers as unused, non-declared, etc, while they are being used by the .c files , declared in other headers that are called by the main .c files, etc.
I am trying to use this plugin in Neovim and testing it with Suckless' DWM. The project compiles fine, so it does not seem logical to me that ALE marks those lines in headers as wrong. GCC is being used both for compiling and linting (no other linters installed), and from what I can see in :ALEInfo, GCC seems to be called with the current opened .h file as argument. This explains to me why all those errors appear, as GCC is trying to compile the header standalone. This is what I deduce.
I would like to know if there is a way to configure ALE so it parses the output of the command that compiles the whole project instead of only the currently opened header. Generating compile_commands.json with bear and setting g:ale_c_parse_compile_commands has helped solving some flags issues, but not this one with the headers. Even using compdb to include headers in compile_commands.json.
Any help will be greatly appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions