Add --nowrap to ispc options

This commit is contained in:
Martino Pilia 2018-11-21 10:40:07 +01:00
parent 9e8f2b0840
commit 66212966dd
No known key found for this signature in database
GPG Key ID: CDEE463095565E17
3 changed files with 22 additions and 300 deletions

View File

@ -5,7 +5,8 @@ call ale#Set('ispc_ispc_executable', 'ispc')
call ale#Set('ispc_ispc_options', '')
function! ale_linters#ispc#ispc#GetCommand(buffer) abort
return '%e'
" --nowrap: do not wrap message lines
return '%e --nowrap'
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
\ . ale#Pad(ale#Var(a:buffer, 'ispc_ispc_options'))
\ . ' %s'
@ -18,39 +19,17 @@ function! ale_linters#ispc#ispc#Handle(buffer, lines) abort
" Message format: <filename>:<lnum>:<col> <type>: <text>
" As far as I know, <type> can be any of:
" 'error', 'Error', 'fatal error', 'Warning', 'Performance Warning'
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+([^:]+):\s+(.+)\s*'
let l:Trim = {s -> substitute(s, '^\s*\(.\{-}\)\s*$', '\1', '')}
let l:line_count = len(a:lines)
let l:re = '\v.+:([0-9]+):([0-9]+):\s+([^:]+):\s+(.+)'
let l:output = []
for l:index in range(l:line_count)
let l:match = matchlist(a:lines[l:index], l:re)
if l:match != []
let l:text = l:Trim(l:match[5])
" The text may continue over multiple lines.
" Look for a full stop, question, or exclamation mark
" ending the text.
" Also, for some reason, 'file not found' messages are on
" one line but not terminated by punctuation.
while match(l:text, '[.?!]\s*$') == -1
\ && match(l:text, 'file not found') == -1
\ && l:index < l:line_count - 1
let l:index += 1
let l:text .= ' ' . l:Trim(a:lines[l:index])
endwhile
call add(l:output, {
\ 'filename': fnamemodify(l:match[1], ':p'),
\ 'bufnr': a:buffer,
\ 'lnum': str2nr(l:match[2]),
\ 'col': str2nr(l:match[3]),
\ 'type': l:match[4] =~? 'error' ? 'E' : 'W',
\ 'text': l:text,
\})
continue
endif
for l:match in ale#util#GetMatches(a:lines, l:re)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
\ 'text': l:match[4],
\})
endfor
return l:output

View File

@ -6,15 +6,15 @@ After:
Execute(The executable should be configurable):
AssertLinter 'ispc',
\ ale#Escape('ispc') . ' %s'
\ ale#Escape('ispc') . ' --nowrap %s'
let b:ale_ispc_ispc_executable = 'foo'
AssertLinter 'foo',
\ ale#Escape('foo') . ' %s'
\ ale#Escape('foo') . ' --nowrap %s'
Execute(The options should be configurable):
let g:ale_ispc_ispc_options = '--foo'
AssertLinter 'ispc',
\ ale#Escape('ispc') . ' --foo' . ' %s'
\ ale#Escape('ispc') . ' --nowrap --foo' . ' %s'

View File

@ -13,9 +13,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 14,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected ''int'', expecting '','' or '';''.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -23,169 +20,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 5,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected ''for''.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 40,
\ 'col': 24,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_re".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 40,
\ 'col': 29,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_re".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 40,
\ 'col': 36,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_im".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 40,
\ 'col': 41,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_im".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 41,
\ 'col': 30,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_re".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 41,
\ 'col': 37,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "z_im".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 42,
\ 'col': 18,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected ''{''.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 58,
\ 'col': 17,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "y1". Did you mean "i", or "or"?',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 58,
\ 'col': 22,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "y0". Did you mean "i", or "or"?',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 58,
\ 'col': 28,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "height".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 60,
\ 'col': 5,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected ''for''.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 71,
\ 'col': 23,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "y0". Did you mean "dy", or "i", or "or"?',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 71,
\ 'col': 28,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "j". Did you mean "i"?',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 73,
\ 'col': 25,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "j". Did you mean "i", or "y"?',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 73,
\ 'col': 29,
\ 'type': 'E',
\ 'text': 'Undeclared symbol "width".',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
\ 'lnum': 74,
\ 'col': 13,
\ 'type': 'E',
\ 'text': 'syntax error, unexpected identifier.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -193,9 +27,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 9,
\ 'type': 'E',
\ 'text': '''foobar.h'' file not found',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -203,9 +34,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 52,
\ 'type': 'W',
\ 'text': 'Modulus operator with varying types is very inefficient.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -213,9 +41,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 13,
\ 'type': 'W',
\ 'text': 'Undefined behavior: all program instances are writing to the same location!',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -223,9 +48,6 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 19,
\ 'type': 'W',
\ 'text': 'Gather required to load value.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ {
\ 'bufnr': 0,
@ -233,114 +55,35 @@ Execute(The ispc handler should parse input correctly):
\ 'col': 9,
\ 'type': 'W',
\ 'text': 'Scatter required to store value.',
\ 'filename': has('win32')
\ ? 'C:\testplugin\test\handler\mandelbrot.ispc'
\ : '/testplugin/test/handler/mandelbrot.ispc',
\ },
\ ],
\ ale_linters#ispc#ispc#Handle(0, [
\ 'Warning: No output file or header file name specified. Program will ',
\ ' be compiled and warnings/errors will be issued, but no output will be ',
\ ' generated. ',
\ 'Warning: No --target specified on command-line. Using default system ',
\ ' target "avx2-i32x8". ',
\ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', ',
\ ' expecting '','' or '';''. ',
\ 'Warning: No output file or header file name specified. Program will be compiled and warnings/errors will be issued, but no output will be generated. ',
\ 'Warning: No --target specified on command-line. Using default system target "avx2-i32x8".',
\ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', expecting '','' or '';''.',
\ 'static iline int mandel(float c_re, float c_im, int count) {',
\ ' ^^^',
\ '',
\ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''. ',
\ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''.',
\ ' for (i = 0; i < count; ++i) {',
\ ' ^^^',
\ '',
\ 'mandelbrot.ispc:40:24: Error: Undeclared symbol "z_re". ',
\ ' float new_re = z_re*z_re - z_im*z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:40:29: Error: Undeclared symbol "z_re". ',
\ ' float new_re = z_re*z_re - z_im*z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:40:36: Error: Undeclared symbol "z_im". ',
\ ' float new_re = z_re*z_re - z_im*z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:40:41: Error: Undeclared symbol "z_im". ',
\ ' float new_re = z_re*z_re - z_im*z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:41:30: Error: Undeclared symbol "z_re". ',
\ ' float new_im = 2.f * z_re * z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:41:37: Error: Undeclared symbol "z_im". ',
\ ' float new_im = 2.f * z_re * z_im;',
\ ' ^^^^',
\ '',
\ 'mandelbrot.ispc:42:18: Error: syntax error, unexpected ''{''. ',
\ ' unmasked {',
\ ' ^',
\ '',
\ 'mandelbrot.ispc:58:17: Error: Undeclared symbol "y1". Did you mean ',
\ ' "i", or "or"? ',
\ ' float dy = (y1 - y0) / height;',
\ ' ^^',
\ '',
\ 'mandelbrot.ispc:58:22: Error: Undeclared symbol "y0". Did you mean ',
\ ' "i", or "or"? ',
\ ' float dy = (y1 - y0) / height;',
\ ' ^^',
\ '',
\ 'mandelbrot.ispc:58:28: Error: Undeclared symbol "height". ',
\ ' float dy = (y1 - y0) / height;',
\ ' ^^^^^^',
\ '',
\ 'mandelbrot.ispc:60:5: Error: syntax error, unexpected ''for''. ',
\ ' for (uniform int j = 0; j < height; j++) {',
\ ' ^^^',
\ '',
\ 'mandelbrot.ispc:71:23: Error: Undeclared symbol "y0". Did you mean ',
\ ' "dy", or "i", or "or"? ',
\ ' float y = y0 + j * dy;',
\ ' ^^',
\ '',
\ 'mandelbrot.ispc:71:28: Error: Undeclared symbol "j". Did you mean ',
\ ' "i"? ',
\ ' float y = y0 + j * dy;',
\ ' ^',
\ '',
\ 'mandelbrot.ispc:73:25: Error: Undeclared symbol "j". Did you mean ',
\ ' "i", or "y"? ',
\ ' int index = j * width + i;',
\ ' ^',
\ '',
\ 'mandelbrot.ispc:73:29: Error: Undeclared symbol "width". ',
\ ' int index = j * width + i;',
\ ' ^^^^^',
\ '',
\ 'mandelbrot.ispc:74:13: Error: syntax error, unexpected ',
\ ' identifier. ',
\ ' output[index] = mandel(x, y, maxIterations);',
\ ' ^^^^^^',
\ '',
\ 'mandelbrot.ispc:51:9: fatal error: ''foobar.h'' file not found',
\ '#include<foobar.h>',
\ ' ^~~~~~~~~~',
\ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with ',
\ ' varying types is very inefficient. ',
\ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with varying types is very inefficient.',
\ ' double x = x0 + i * (dx + epsilon*(k%2)*delta);',
\ ' ^^^',
\ '',
\ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program ',
\ ' instances are writing to the same location! ',
\ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program instances are writing to the same location!',
\ ' output[index] = (NNN) / sample_size;',
\ ' ^^^^^^^^^^^^^',
\ '',
\ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value. ',
\ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value.',
\ ' A[i*8] *= A[i*8];',
\ ' ^^^^^^',
\ '',
\ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value. ',
\ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value.',
\ ' A[i*8] *= A[i*8];',
\ ' ^^^^^^',
\ '',