Skip to content

Commit d047b28

Browse files
Qinghao ShiQinghao Shi
Qinghao Shi
authored and
Qinghao Shi
committed
TOOLS: add some inline comments
1 parent e6fe03f commit d047b28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/toolchains/gcc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,18 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
137137
self.use_distcc = (bool(getenv("DISTCC_POTENTIAL_HOSTS", False))
138138
and not getenv("MBED_DISABLE_DISTCC", False))
139139

140+
# create copies of gcc/ld options as coverage build options, and injects extra coverage options
140141
self.coverage_cc = self.cc + ["--coverage", "-DENABLE_LIBGCOV_PORT"]
141142
self.coverage_cppc = self.cppc + ["--coverage", "-DENABLE_LIBGCOV_PORT"]
142143
self.coverage_ld = self.ld + ['--coverage', '-Wl,--wrap,GREENTEA_SETUP', '-Wl,--wrap,_Z25GREENTEA_TESTSUITE_RESULTi']
143144

145+
# for gcc coverage options remove MBED_DEBUG macro (this is required by code coverage function)
144146
for flag in ["-DMBED_DEBUG"]:
145147
if flag in self.coverage_cc:
146148
self.coverage_cc.remove(flag)
147149
if flag in self.coverage_cppc:
148150
self.coverage_cppc.remove(flag)
151+
# for lg coverage options remove exit wrapper (this is required by code coverage function)
149152
for flag in ['-Wl,--wrap,exit', '-Wl,--wrap,atexit']:
150153
if flag in self.coverage_ld:
151154
self.coverage_ld.remove(flag)
@@ -224,6 +227,7 @@ def get_compile_options(self, defines, includes, for_asm=False):
224227
return opts
225228

226229
def match_coverage_patterns(self, source):
230+
"""Check whether the give source file match with coverage patterns, if so return True. """
227231
for pattern in self.coverage_patterns:
228232
if fnmatch.fnmatch(source, pattern):
229233
return True

0 commit comments

Comments
 (0)