Clean up notifier API usage in compilers

pull/6781/head
Jimmy Brisson 2018-04-26 09:33:37 -05:00
parent de91c93108
commit 56ec4677b5
3 changed files with 18 additions and 23 deletions

View File

@ -227,13 +227,13 @@ class Resources:
for objname, filenames in dupe_dict.items():
if len(filenames) > 1:
count+=1
toolchain.tool_error(
toolchain.notify.tool_error(
"Object file %s.o is not unique! It could be made from: %s"\
% (objname, " ".join(filenames)))
for headername, locations in dupe_headers.items():
if len(locations) > 1:
count+=1
toolchain.tool_error(
toolchain.notify.tool_error(
"Header file %s is not unique! It could be: %s" %\
(headername, " ".join(locations)))
return count
@ -1110,7 +1110,7 @@ class mbedToolchain:
if _rc != 0:
for line in _stderr.splitlines():
self.tool_error(line)
self.notify.tool_error(line)
raise ToolException(_stderr)
def progress(self, action, file, build_update=False):

View File

@ -28,11 +28,9 @@ class GCC(mbedToolchain):
STD_LIB_NAME = "lib%s.a"
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,
def __init__(self, target, notify=None, macros=None, build_profile=None,
build_dir=None):
mbedToolchain.__init__(self, target, notify, macros, silent,
extra_verbose=extra_verbose,
mbedToolchain.__init__(self, target, notify, macros,
build_profile=build_profile, build_dir=build_dir)
tool_path=TOOLCHAIN_PATHS['GCC_ARM']
@ -119,7 +117,7 @@ class GCC(mbedToolchain):
match = self.DIAGNOSTIC_PATTERN.search(line)
if match is not None:
if msg is not None:
self.cc_info(msg)
self.notify.cc_info(msg)
msg = None
msg = {
'severity': match.group('severity').lower(),
@ -133,7 +131,7 @@ class GCC(mbedToolchain):
}
if msg is not None:
self.cc_info(msg)
self.notify.cc_info(msg)
def get_dep_option(self, object):
base, _ = splitext(object)
@ -200,7 +198,7 @@ class GCC(mbedToolchain):
preproc_output = join(dirname(output), ".link_script.ld")
cmd = (self.preproc + [mem_map] + self.ld[1:] +
[ "-o", preproc_output])
self.cc_verbose("Preproc: %s" % ' '.join(cmd))
self.notify.cc_verbose("Preproc: %s" % ' '.join(cmd))
self.default_cmd(cmd)
mem_map = preproc_output
@ -230,10 +228,10 @@ class GCC(mbedToolchain):
cmd = [cmd_linker, "@%s" % link_files]
# Exec command
self.cc_verbose("Link: %s" % ' '.join(cmd))
self.notify.cc_verbose("Link: %s" % ' '.join(cmd))
self.default_cmd(cmd)
if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33":
self.info("Secure Library Object %s" %secure_file)
self.notify.info("Secure Library Object %s" %secure_file)
@hook_tool
def archive(self, objects, lib_path):
@ -256,7 +254,7 @@ class GCC(mbedToolchain):
cmd = self.hook.get_cmdline_binary(cmd)
# Exec command
self.cc_verbose("FromELF: %s" % ' '.join(cmd))
self.notify.cc_verbose("FromELF: %s" % ' '.join(cmd))
self.default_cmd(cmd)
@staticmethod

View File

@ -36,12 +36,9 @@ class IAR(mbedToolchain):
Returns False otherwise."""
return mbedToolchain.generic_check_executable("IAR", 'iccarm', 2, "bin")
def __init__(self, target, notify=None, macros=None,
silent=False, extra_verbose=False, build_profile=None,
def __init__(self, target, notify=None, macros=None, build_profile=None,
build_dir=None):
mbedToolchain.__init__(self, target, notify, macros, silent,
build_dir=build_dir,
extra_verbose=extra_verbose,
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)
if target.core == "Cortex-M7F" or target.core == "Cortex-M7FD":
cpuchoice = "Cortex-M7"
@ -104,7 +101,7 @@ class IAR(mbedToolchain):
match = IAR.DIAGNOSTIC_PATTERN.match(line)
if match is not None:
if msg is not None:
self.cc_info(msg)
self.notify.cc_info(msg)
msg = None
msg = {
'severity': match.group('severity').lower(),
@ -121,13 +118,13 @@ class IAR(mbedToolchain):
match = IAR.INDEX_PATTERN.match(line)
if match is not None:
msg['col'] = len(match.group('col'))
self.cc_info(msg)
self.notify.cc_info(msg)
msg = None
else:
msg['text'] += line+"\n"
if msg is not None:
self.cc_info(msg)
self.notify.cc_info(msg)
def get_dep_option(self, object):
base, _ = splitext(object)
@ -207,7 +204,7 @@ class IAR(mbedToolchain):
cmd = [cmd_linker, '-f', link_files]
# Exec command
self.cc_verbose("Link: %s" % ' '.join(cmd))
self.notify.cc_verbose("Link: %s" % ' '.join(cmd))
self.default_cmd(cmd)
@hook_tool
@ -233,7 +230,7 @@ class IAR(mbedToolchain):
cmd = self.hook.get_cmdline_binary(cmd)
# Exec command
self.cc_verbose("FromELF: %s" % ' '.join(cmd))
self.notify.cc_verbose("FromELF: %s" % ' '.join(cmd))
self.default_cmd(cmd)
@staticmethod