File tree Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 20
20
21
21
from tools .export .exporters import Exporter , ExporterTargetsProperty
22
22
from tools .targets import TARGET_MAP , TARGET_NAMES
23
+ from tools .utils import remove_when_present
23
24
24
25
# If you wish to add a new target, add it to project_generator_definitions, and then
25
26
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -63,7 +64,7 @@ def generate(self):
63
64
64
65
project_data ['misc' ] = self .flags
65
66
# VLA is enabled via template IccAllowVLA
66
- project_data ['misc' ]['c_flags' ]. remove ("--vla" )
67
+ remove_when_present ( project_data ['misc' ]['c_flags' ], ("--vla" ) )
67
68
project_data ['build_dir' ] = os .path .join (project_data ['build_dir' ], 'iar_arm' )
68
69
self .progen_gen_file (project_data )
69
70
Original file line number Diff line number Diff line change 19
19
20
20
from tools .export .exporters import Exporter , ExporterTargetsProperty
21
21
from tools .targets import TARGET_MAP , TARGET_NAMES
22
+ from tools .utils import remove_when_present
22
23
23
24
# If you wish to add a new target, add it to project_generator_definitions, and then
24
25
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -84,11 +85,11 @@ def generate(self):
84
85
+ self .flags ['c_flags' ]
85
86
+ self .flags ['cxx_flags' ]))
86
87
# not compatible with c99 flag set in the template
87
- project_data ['misc' ]['c_flags' ]. remove ( "--c99" )
88
+ remove_when_present ( project_data ['misc' ]['c_flags' ], "--c99" )
88
89
# cpp is not required as it's implicit for cpp files
89
- project_data ['misc' ]['c_flags' ]. remove ( "--cpp" )
90
+ remove_when_present ( project_data ['misc' ]['c_flags' ], "--cpp" )
90
91
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
91
- project_data ['misc' ]['c_flags' ]. remove ( "--no_vla" )
92
+ remove_when_present ( project_data ['misc' ]['c_flags' ], "--no_vla" )
92
93
project_data ['misc' ]['ld_flags' ] = self .flags ['ld_flags' ]
93
94
94
95
project_data ['build_dir' ] = project_data ['build_dir' ] + '\\ ' + 'uvision4'
Original file line number Diff line number Diff line change 19
19
20
20
from tools .export .exporters import Exporter , ExporterTargetsProperty
21
21
from tools .targets import TARGET_MAP , TARGET_NAMES
22
+ from tools .utils import remove_when_present
22
23
23
24
# If you wish to add a new target, add it to project_generator_definitions, and then
24
25
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
@@ -84,11 +85,11 @@ def generate(self):
84
85
+ self .flags ['c_flags' ]
85
86
+ self .flags ['cxx_flags' ]))
86
87
# not compatible with c99 flag set in the template
87
- project_data ['misc' ]['c_flags' ]. remove ("--c99" )
88
+ remove_when_present ( project_data ['misc' ]['c_flags' ], ("--c99" ) )
88
89
# cpp is not required as it's implicit for cpp files
89
- project_data ['misc' ]['c_flags' ]. remove ("--cpp" )
90
+ remove_when_present ( project_data ['misc' ]['c_flags' ], ("--cpp" ) )
90
91
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
91
- project_data ['misc' ]['c_flags' ]. remove ("--no_vla" )
92
+ remove_when_present ( project_data ['misc' ]['c_flags' ], ("--no_vla" ) )
92
93
project_data ['misc' ]['ld_flags' ] = self .flags ['ld_flags' ]
93
94
94
95
i = 0
Original file line number Diff line number Diff line change @@ -470,3 +470,7 @@ def parse_type(not_parent):
470
470
else :
471
471
return not_parent
472
472
return parse_type
473
+
474
+ def remove_when_present (list , thing ):
475
+ if thing in list :
476
+ list .remove (thing )
You can’t perform that action at this time.
0 commit comments