Merge pull request #5915 from DBS06/gcc_msg_parsing

Simplify and Improve error/warning parser for gcc_arm
pull/5714/merge
Martin Kojtal 2018-02-19 17:34:43 +01:00 committed by GitHub
commit 636ced8ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 12 deletions

View File

@ -26,8 +26,7 @@ class GCC(mbedToolchain):
LIBRARY_EXT = '.a'
STD_LIB_NAME = "lib%s.a"
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
def __init__(self, target, notify=None, macros=None,
silent=False, extra_verbose=False, build_profile=None,
@ -125,21 +124,12 @@ class GCC(mbedToolchain):
'severity': match.group('severity').lower(),
'file': match.group('file'),
'line': match.group('line'),
'col': 0,
'col': match.group('col'),
'message': match.group('message'),
'text': '',
'target_name': self.target.name,
'toolchain_name': self.name
}
elif msg is not None:
# Determine the warning/error column by calculating the ^ position
match = self.INDEX_PATTERN.match(line)
if match is not None:
msg['col'] = len(match.group('col'))
self.cc_info(msg)
msg = None
else:
msg['text'] += line+"\n"
if msg is not None:
self.cc_info(msg)