Skip to content

Commit bed8a0b

Browse files
theotherjimmyDeepika
authored and
Deepika
committed
Use relative path to detect config header and remove -std options
1 parent 15e8d94 commit bed8a0b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tools/export/uvision/__init__.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from os.path import sep, normpath, join, exists
2+
from os.path import sep, normpath, join, exists, relpath
33
import ntpath
44
import copy
55
from collections import namedtuple
@@ -163,13 +163,16 @@ 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())
166+
config_header = self.toolchain.get_config_header()
167+
config_header = relpath(config_header,
168+
self.resources.file_basepath[config_header])
169+
config_option = self.toolchain.get_config_option(config_header)
168170
c_flags = set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags'])
169-
in_template = set(["--no_vla", "--cpp", "--c99", "-std=gnu99",
170-
"-std=g++98"] + config_option)
171+
in_template = set(["--no_vla", "--cpp", "--c99"] + config_option)
171172

172-
invalid_flag = lambda x: x in in_template or x.startswith("-O")
173+
invalid_flag = lambda x: (x in in_template or
174+
x.startswith("-O") or
175+
x.startswith("-std"))
173176
is_define = lambda s: s.startswith("-D")
174177

175178
flags['c_flags'] = " ".join(f.replace('"','\\"') for f in c_flags
@@ -178,6 +181,7 @@ def format_flags(self):
178181
flags['c_flags'] += " ".join(config_option)
179182
flags['c_defines'] = " ".join(f[2:] for f in c_flags if is_define(f))
180183
flags['ld_flags'] = " ".join(set(flags['ld_flags']))
184+
print(flags['c_flags'])
181185
return flags
182186

183187
def format_src(self, srcs):

0 commit comments

Comments
 (0)