Skip to content

Commit 0924d66

Browse files
committed
Fix a few flag-related things
1 parent 1eb4793 commit 0924d66

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tools/export/exporters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ def flags(self):
112112
flags['cxx_flags'] += c_defines
113113
config_header = self.config_header_ref
114114
if config_header:
115-
flags['c_flags'] += self.toolchain.get_config_option(
116-
config_header.name)
117-
flags['cxx_flags'] += self.toolchain.get_config_option(
115+
config_option = self.toolchain.get_config_option(
118116
config_header.name)
117+
flags['c_flags'] += config_option
118+
flags['cxx_flags'] += config_option
119119
return flags
120120

121121
@property

tools/export/uvision/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ def format_flags(self):
178178
",".join(filter(lambda f: f.startswith("-D"), flags['asm_flags'])))
179179
flags['asm_flags'] = asm_flag_string
180180

181-
config_option = self.toolchain.get_config_option(
182-
self.toolchain.get_config_header())
181+
config_header = self.config_header_ref
182+
config_option = self.toolchain.get_config_option(config_header.name)
183183
c_flags = set(
184184
flags['c_flags'] + flags['cxx_flags'] + flags['common_flags']
185185
)
@@ -189,17 +189,18 @@ def format_flags(self):
189189

190190
def valid_flag(x):
191191
return (
192-
x not in in_template or
193-
not x.startswith("-O") or
194-
not x.startswith("-std") or
192+
x not in in_template and
193+
not x.startswith("-O") and
194+
not x.startswith("-std") and
195195
not x.startswith("-D")
196196
)
197197

198198
def is_define(s):
199199
return s.startswith("-D") and "(" not in s
200200

201-
flags['c_flags'] = " ".join(f.replace('"', '\\"') for f in c_flags
202-
if (valid_flag(f) and not is_define(f)))
201+
flags['c_flags'] = " ".join(
202+
f.replace('"', '\\"') for f in c_flags if valid_flag(f)
203+
)
203204
flags['c_flags'] += " "
204205
flags['c_flags'] += " ".join(config_option)
205206
flags['c_defines'] = " ".join(f[2:] for f in c_flags if is_define(f))

0 commit comments

Comments
 (0)