I want to write OpenCL syntax checker for vim-opencl plugin. OpenCL compiler do some strange formatting of output errors. There are two types of errors.
Normal (with small error explanation):
"/tmp/OCLUKvOsF.cl", line 143: error: expression must have integral type
rec_table[PRIME_P - ri] = PRIME_P - i;
^
And not-normal with line-break in error explanation:
"/tmp/OCLUKvOsF.cl", line 148: error: a value of type "uint16" cannot be used
to initialize an entity of type "uint"
uint a = value, b = PRIME_P, u = 0, v = 0;
^
So trouble is in concatenation of two parts of broken error explanation in second case and normal error handling in first case.
I'm using syntastic as generel syntax checker. Now I have such code for it:
let errorformat = '%E"%f"\, line %l: error: %m,%+C%.%#,%-Z%p^,'.
\'%W"%f"\, line %l: warning: %m,%-C%.%#,'.
\'%-G%.%#'
So first and second errors look following:
program.cl|143 error| expression must have integral type rec_table[PRIME_P - ri] = PRIME_P - i; ^
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint" uint a = value, b = PRIME_P, u = 0, v = 0;
It almost ok (especially in second case), but I don't know how to make it like this:
program.cl|143 col 19 error| expression must have integral type
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint"
Or at least like this:
program.cl|143 col 19 error| expression must have integral type rec_table[PRIME_P - ri] = PRIME_P - i;
program.cl|148 col 14 error| a value of type "uint16" cannot be used to initialize an entity of type "uint" uint a = value, b = PRIME_P, u = 0, v = 0;
Do you have some idea?
UPD. Updated errorformat and expectations
I don't know of a useful way to test this but you need to escape your spaces with a backslash too.
I might also put a -space after the
%C
s so that they only match lines starting with a space.Finally for warnings you're ignoring some lines and never have a
%Z
anywhere. (I don't think you need the minus in front of the Z but I'm not clear on that; I don't use the minus myself.Good luck.