Skip to content

Commit 56ec467

Browse files
committed
Clean up notifier API usage in compilers
1 parent de91c93 commit 56ec467

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

tools/toolchains/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ def detect_duplicates(self, toolchain):
227227
for objname, filenames in dupe_dict.items():
228228
if len(filenames) > 1:
229229
count+=1
230-
toolchain.tool_error(
230+
toolchain.notify.tool_error(
231231
"Object file %s.o is not unique! It could be made from: %s"\
232232
% (objname, " ".join(filenames)))
233233
for headername, locations in dupe_headers.items():
234234
if len(locations) > 1:
235235
count+=1
236-
toolchain.tool_error(
236+
toolchain.notify.tool_error(
237237
"Header file %s is not unique! It could be: %s" %\
238238
(headername, " ".join(locations)))
239239
return count
@@ -1110,7 +1110,7 @@ def default_cmd(self, command):
11101110

11111111
if _rc != 0:
11121112
for line in _stderr.splitlines():
1113-
self.tool_error(line)
1113+
self.notify.tool_error(line)
11141114
raise ToolException(_stderr)
11151115

11161116
def progress(self, action, file, build_update=False):

tools/toolchains/gcc.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ class GCC(mbedToolchain):
2828
STD_LIB_NAME = "lib%s.a"
2929
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
3030

31-
def __init__(self, target, notify=None, macros=None,
32-
silent=False, extra_verbose=False, build_profile=None,
31+
def __init__(self, target, notify=None, macros=None, build_profile=None,
3332
build_dir=None):
34-
mbedToolchain.__init__(self, target, notify, macros, silent,
35-
extra_verbose=extra_verbose,
33+
mbedToolchain.__init__(self, target, notify, macros,
3634
build_profile=build_profile, build_dir=build_dir)
3735

3836
tool_path=TOOLCHAIN_PATHS['GCC_ARM']
@@ -119,7 +117,7 @@ def parse_output(self, output):
119117
match = self.DIAGNOSTIC_PATTERN.search(line)
120118
if match is not None:
121119
if msg is not None:
122-
self.cc_info(msg)
120+
self.notify.cc_info(msg)
123121
msg = None
124122
msg = {
125123
'severity': match.group('severity').lower(),
@@ -133,7 +131,7 @@ def parse_output(self, output):
133131
}
134132

135133
if msg is not None:
136-
self.cc_info(msg)
134+
self.notify.cc_info(msg)
137135

138136
def get_dep_option(self, object):
139137
base, _ = splitext(object)
@@ -200,7 +198,7 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
200198
preproc_output = join(dirname(output), ".link_script.ld")
201199
cmd = (self.preproc + [mem_map] + self.ld[1:] +
202200
[ "-o", preproc_output])
203-
self.cc_verbose("Preproc: %s" % ' '.join(cmd))
201+
self.notify.cc_verbose("Preproc: %s" % ' '.join(cmd))
204202
self.default_cmd(cmd)
205203
mem_map = preproc_output
206204

@@ -230,10 +228,10 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
230228
cmd = [cmd_linker, "@%s" % link_files]
231229

232230
# Exec command
233-
self.cc_verbose("Link: %s" % ' '.join(cmd))
231+
self.notify.cc_verbose("Link: %s" % ' '.join(cmd))
234232
self.default_cmd(cmd)
235233
if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33":
236-
self.info("Secure Library Object %s" %secure_file)
234+
self.notify.info("Secure Library Object %s" %secure_file)
237235

238236
@hook_tool
239237
def archive(self, objects, lib_path):
@@ -256,7 +254,7 @@ def binary(self, resources, elf, bin):
256254
cmd = self.hook.get_cmdline_binary(cmd)
257255

258256
# Exec command
259-
self.cc_verbose("FromELF: %s" % ' '.join(cmd))
257+
self.notify.cc_verbose("FromELF: %s" % ' '.join(cmd))
260258
self.default_cmd(cmd)
261259

262260
@staticmethod

tools/toolchains/iar.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ def check_executable():
3636
Returns False otherwise."""
3737
return mbedToolchain.generic_check_executable("IAR", 'iccarm', 2, "bin")
3838

39-
def __init__(self, target, notify=None, macros=None,
40-
silent=False, extra_verbose=False, build_profile=None,
39+
def __init__(self, target, notify=None, macros=None, build_profile=None,
4140
build_dir=None):
42-
mbedToolchain.__init__(self, target, notify, macros, silent,
43-
build_dir=build_dir,
44-
extra_verbose=extra_verbose,
41+
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir,
4542
build_profile=build_profile)
4643
if target.core == "Cortex-M7F" or target.core == "Cortex-M7FD":
4744
cpuchoice = "Cortex-M7"
@@ -104,7 +101,7 @@ def parse_output(self, output):
104101
match = IAR.DIAGNOSTIC_PATTERN.match(line)
105102
if match is not None:
106103
if msg is not None:
107-
self.cc_info(msg)
104+
self.notify.cc_info(msg)
108105
msg = None
109106
msg = {
110107
'severity': match.group('severity').lower(),
@@ -121,13 +118,13 @@ def parse_output(self, output):
121118
match = IAR.INDEX_PATTERN.match(line)
122119
if match is not None:
123120
msg['col'] = len(match.group('col'))
124-
self.cc_info(msg)
121+
self.notify.cc_info(msg)
125122
msg = None
126123
else:
127124
msg['text'] += line+"\n"
128125

129126
if msg is not None:
130-
self.cc_info(msg)
127+
self.notify.cc_info(msg)
131128

132129
def get_dep_option(self, object):
133130
base, _ = splitext(object)
@@ -207,7 +204,7 @@ def link(self, output, objects, libraries, lib_dirs, mem_map):
207204
cmd = [cmd_linker, '-f', link_files]
208205

209206
# Exec command
210-
self.cc_verbose("Link: %s" % ' '.join(cmd))
207+
self.notify.cc_verbose("Link: %s" % ' '.join(cmd))
211208
self.default_cmd(cmd)
212209

213210
@hook_tool
@@ -233,7 +230,7 @@ def binary(self, resources, elf, bin):
233230
cmd = self.hook.get_cmdline_binary(cmd)
234231

235232
# Exec command
236-
self.cc_verbose("FromELF: %s" % ' '.join(cmd))
233+
self.notify.cc_verbose("FromELF: %s" % ' '.join(cmd))
237234
self.default_cmd(cmd)
238235

239236
@staticmethod

0 commit comments

Comments
 (0)