From da4a16975200113899c47a8b60952bd1cd030e8e Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Mon, 6 Jun 2016 18:19:59 +0100 Subject: [PATCH] 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. --- tools/toolchains/gcc.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index 0a0b91f410..e1313ef474 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -28,7 +28,7 @@ class GCC(mbedToolchain): STD_LIB_NAME = "lib%s.a" CIRCULAR_DEPENDENCIES = True - DIAGNOSTIC_PATTERN = re.compile('((?P\d+):)(\d+:)? (?Pwarning|error): (?P.+)') + DIAGNOSTIC_PATTERN = re.compile('((?P[^:]+):(?P\d+):)(\d+:)? (?Pwarning|error): (?P.+)') def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False): mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose) @@ -138,27 +138,16 @@ class GCC(mbedToolchain): ) continue - # Each line should start with the file information: "filepath: ..." - # i should point past the file path ^ - # avoid the first column in Windows (C:\) - i = line.find(':', 2) - if i == -1: continue - - if state == WHERE: - file = line[:i] - message = line[i+1:].strip() + ' ' - state = WHAT - - elif state == WHAT: - match = GCC.DIAGNOSTIC_PATTERN.match(line[i+1:]) - if match is None: - state = WHERE - continue + match = GCC.DIAGNOSTIC_PATTERN.match(line) + if match is not None: self.cc_info( - match.group('severity'), - file, match.group('line'), - message + match.group('message') + match.group('severity').lower(), + match.group('file'), + match.group('line'), + match.group('message'), + target_name=self.target.name, + toolchain_name=self.name ) def get_dep_option(self, object):