Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Error messages are detected and parsed using a regex. Part of this regex
matches the optional column number.
The code that handled this assumed that a missing column would result in
less elements in the matches array, but a regex always results in one
element per set of parenthesis in the regex, which will be null if no
capture was made for that element.
In practice, this meant that if no column was present in the error
message, a NullPointerException would be raised. Furthermore, gcc 9
seems to have started outputting omitting column numbers (instead of
printing 0) for some errors (such as unterminated #ifdef), which exposed
this problem.
To reproduce, install a core that uses gcc 9, such as Arduino_Core_STM32, select a board from that core and compile any sketch that contains in unterminated ifdef, e.g.:
On AVR, this results in:
On STM32, I get:
Note the missing error message, only the quoted source lines for the error are present. gcc-9 also changed the way it indicates source lines using a
|
prefix, but that is handled just fine.A second problem is that "fatal" would be stripped from error messages. e.g.
But compiling the same line in the IDE (using the AVR core) gives:
Note the missing "fatal". There is also some intermixing of stdout and stderr, but that is a separate issue.
This PR fixes both problems by improving the compiler error message parsing. See the commit messages for implementation details.
With this PR, columless error message are shown properly (below with the STM32 core):
Also, fatal errors are now again shown as such (below uses the AVR core again):