fixed problemmatcher regexp#6490
Conversation
|
How do we repro gcc outputting warnings/errors without a column? |
|
You can write a task that does an 'echo' of an error line without the column and set the problem matcher to this version of gcc. |
Yeah, if required for testing, but I wanted to know how to repro the issue with gcc, i.e. what does "some gcc versions" mean? |
|
Sorry, for not mentioning the version. I just exchanged the file names. I tested the regular expression on regex101.com until it worked as intended. According to https://stackoverflow.com/questions/54541148/how-to-define-a-problem-matcher-for-cppcheck-task-in-vscode you can also reproduce the error when using cppcheck 1.82. |
sean-mcmanus
left a comment
There was a problem hiding this comment.
[^:]* doesn't seems to work with Windows style file paths (e.g. c:\Users). This might be fixable via adding something like (.:)? before that. I think the original .* was not 100% guaranteed to work.
|
Indeed, Windows style full paths did not work. So I extended my test cases to I now changed the first group to (.*?), which is now doing lazy matching. This also prevents the line number to become part of the filename, if the column number is missing. |
Is this test case valid (no colon after the comma) or should the regex |
Indeed, I missed the colon there. I updated the test cases in my comment accordingly. However, my proposed version works with and without this colon. So in my point of view both versions work, although slightly differently. It is up to you, which version you prefer. |
|
|
Yeah, that seems fine to me. |
|
Your fix is available with https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.0-insiders2 |
Some gcc versions do not print the column number of an error or warning. These will not be catched by the problem matcher. I tweaked the regular expression so that it also matches, when the column number is not present.
The change in the first group is necessary so that it does not expand because of the greedyness to include the line number. It could also be replaced by (.*?) to have lazy matching.