Skip to content

Commit 15e8d94

Browse files
theotherjimmyDeepika
authored andcommitted
Correct check for in-template flags
It was named and used as if it were positive logic, and written with negative logic. This changes the name and usage to negative logic.
1 parent 67499b2 commit 15e8d94

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/export/uvision/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,19 @@ def format_flags(self):
163163
",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags'])))
164164
flags['asm_flags'] = asm_flag_string
165165

166+
config_option = self.toolchain.get_config_option(
167+
self.toolchain.get_config_header())
166168
c_flags = set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags'])
167169
in_template = set(["--no_vla", "--cpp", "--c99", "-std=gnu99",
168-
"-std=g++98"] + self.toolchain.get_config_option(
169-
self.toolchain.get_config_header()))
170+
"-std=g++98"] + config_option)
170171

171-
valid_flag = lambda x: x not in in_template or not x.startswith("-O")
172+
invalid_flag = lambda x: x in in_template or x.startswith("-O")
172173
is_define = lambda s: s.startswith("-D")
173174

174175
flags['c_flags'] = " ".join(f.replace('"','\\"') for f in c_flags
175-
if (valid_flag(f) and not is_define(f)))
176-
flags['c_flags'] += " ".join(self.toolchain.get_config_option(
177-
self.toolchain.get_config_header()))
176+
if (not invalid_flag(f) and not is_define(f)))
177+
flags['c_flags'] += " "
178+
flags['c_flags'] += " ".join(config_option)
178179
flags['c_defines'] = " ".join(f[2:] for f in c_flags if is_define(f))
179180
flags['ld_flags'] = " ".join(set(flags['ld_flags']))
180181
return flags

0 commit comments

Comments
 (0)