Skip to content

Commit da4a169

Browse files
committed
Fixing issue with non-verbose error message for GCC
There was an issue when compiling with GCC_ARM, the tools would print the incorrect file where the error was present. This modifies the regular expression and matching logic used to find the error. This was tested with the 4.9 q2 release of GCC ARM.
1 parent 68cb86f commit da4a169

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

tools/toolchains/gcc.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class GCC(mbedToolchain):
2828

2929
STD_LIB_NAME = "lib%s.a"
3030
CIRCULAR_DEPENDENCIES = True
31-
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
31+
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
3232

3333
def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False):
3434
mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
@@ -138,27 +138,16 @@ def parse_output(self, output):
138138
)
139139
continue
140140

141-
# Each line should start with the file information: "filepath: ..."
142-
# i should point past the file path ^
143-
# avoid the first column in Windows (C:\)
144-
i = line.find(':', 2)
145-
if i == -1: continue
146-
147-
if state == WHERE:
148-
file = line[:i]
149-
message = line[i+1:].strip() + ' '
150-
state = WHAT
151-
152-
elif state == WHAT:
153-
match = GCC.DIAGNOSTIC_PATTERN.match(line[i+1:])
154-
if match is None:
155-
state = WHERE
156-
continue
157141

142+
match = GCC.DIAGNOSTIC_PATTERN.match(line)
143+
if match is not None:
158144
self.cc_info(
159-
match.group('severity'),
160-
file, match.group('line'),
161-
message + match.group('message')
145+
match.group('severity').lower(),
146+
match.group('file'),
147+
match.group('line'),
148+
match.group('message'),
149+
target_name=self.target.name,
150+
toolchain_name=self.name
162151
)
163152

164153
def get_dep_option(self, object):

0 commit comments

Comments
 (0)