Skip to content

Commit 3ce173b

Browse files
Simplify and Improve error/warning parser for arm_gcc
1 parent f1cf77f commit 3ce173b

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

tools/toolchains/gcc.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class GCC(mbedToolchain):
2626
LIBRARY_EXT = '.a'
2727

2828
STD_LIB_NAME = "lib%s.a"
29-
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
30-
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
29+
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
3130

3231
def __init__(self, target, notify=None, macros=None,
3332
silent=False, extra_verbose=False, build_profile=None,
@@ -128,21 +127,12 @@ def parse_output(self, output):
128127
'severity': match.group('severity').lower(),
129128
'file': match.group('file'),
130129
'line': match.group('line'),
131-
'col': 0,
130+
'col': match.group('col'),
132131
'message': match.group('message'),
133132
'text': '',
134133
'target_name': self.target.name,
135134
'toolchain_name': self.name
136135
}
137-
elif msg is not None:
138-
# Determine the warning/error column by calculating the ^ position
139-
match = self.INDEX_PATTERN.match(line)
140-
if match is not None:
141-
msg['col'] = len(match.group('col'))
142-
self.cc_info(msg)
143-
msg = None
144-
else:
145-
msg['text'] += line+"\n"
146136

147137
if msg is not None:
148138
self.cc_info(msg)

0 commit comments

Comments
 (0)