vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.3k stars 1.14k forks source link

[question] is syntastic_c_remove_include_errors works for gcc.vim file too? #2262

Closed mrkz closed 5 years ago

mrkz commented 5 years ago

Hello,

TL;DR: I'm looking forward to ignore Include header errors such as

src/daemon.c|44 col 10 error| fatal error: config.h: No such file or directory

But placing let g:syntastic_c_remove_include_errors = 1 does not help, where Syntastic shows the following on the status bar:

[Location List] :SyntasticCheck gcc (c)

I see syntastic_c_remove_include_errors is included in syntax_checkers/c/make.vim but not in syntax_checkers/c/gcc.vim

Should this work or I'm effectively hitting an issue of this flag not being honored?


Looking :help syntastic-commands I found:

                                       'g:syntastic_c_remove_include_errors'
Type: boolean
Default: 0
By default, errors in files included from the file being checked are shown.
Set this variable to 1 to remove messages about errors in included files.
Please note that this means syntastic will silently abort checks if there are
fatal errors in one of the included files.

However, this is not the case on my use case (Using vim on a linux-terminal to open a C project ). My guess is that (as mentioned previously) this flag is not being used on gcc.vim, but still, I'm unsure if this file is the current used on my use-case described.

lcd047 commented 5 years ago

Actually, syntastic_c_remove_include_errors is about errors that happen inside included files, while your error is located in src/daemon.c.

In principle you could use syntastic_quiet_messages to silence it (cf. :h 'syntastic_quiet_messages'), but in practice that would be less than useful since the error is fatal, the compiler simply bails out at that point. So you can remove the error, but you won't get any further checking anyway. This is a limitation of gcc, as far as I know there is no way to trick it to keep going after stumbling upon missing include files. Your best option is to comment out the offending #include line. shrug

mrkz commented 5 years ago

I understand now, thanks for the explanation @lcd047

closing the issue now.