Skip to content

Commit 636ced8

Browse files
authored
Merge pull request #5915 from DBS06/gcc_msg_parsing
Simplify and Improve error/warning parser for gcc_arm
2 parents 3fec23e + 3ce173b commit 636ced8

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,
@@ -125,21 +124,12 @@ def parse_output(self, output):
125124
'severity': match.group('severity').lower(),
126125
'file': match.group('file'),
127126
'line': match.group('line'),
128-
'col': 0,
127+
'col': match.group('col'),
129128
'message': match.group('message'),
130129
'text': '',
131130
'target_name': self.target.name,
132131
'toolchain_name': self.name
133132
}
134-
elif msg is not None:
135-
# Determine the warning/error column by calculating the ^ position
136-
match = self.INDEX_PATTERN.match(line)
137-
if match is not None:
138-
msg['col'] = len(match.group('col'))
139-
self.cc_info(msg)
140-
msg = None
141-
else:
142-
msg['text'] += line+"\n"
143133

144134
if msg is not None:
145135
self.cc_info(msg)

0 commit comments

Comments
 (0)