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

Cannot parse multiline gfortran warnings #1752

Open jhrmnn opened 8 years ago

jhrmnn commented 8 years ago

It seems that gfortran (5.3.0) can ocassionally throw multiline warnings, such as:

read_control.f90:8488.5:

   89 continue
     1
read_control.f90:8472.71:

            read(inputline,*,end=89,err=99) desc_str, n_core_states_soc
                                                                       2
Warning: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)

Currently, this is parsed by syntastic as a an error and a warning. Any idea how to support this? Just ignoring the first line would be perfectly fine, I guess.

lcd047 commented 8 years ago

I don't think it's possible to handle this correctly with Vim's errorformat. It might be possible to address the problem with a preprocess function, but I'm afraid I don't know enough about gfortran error messages to do that (I haven't run gfortran in some ~25 years).

jhrmnn commented 8 years ago

How about hardcoding the warning string and if it matches, ignoring the previous error?

lcd047 commented 8 years ago

This is not a good solution, it pretty much amounts to changing things without understanding them first. Is this the only case that needs to be fixed? Does it break anything? Did you check with gfortran's sources?

If the spurious error bothers you, you can use the function SyntasticCheckHook() to mark the relevant item invalid. The function is called with the list of errors as an argument, and it isn't supposed to return anything. You can't delete any error from it, but you can set the valid field of the relevant items to 0. Or you could just use syntastic_quiet_messages to hide the offending messages.