diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 2daa98f23aa7..617229d60e1d 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -702,7 +702,7 @@ def generate_compdb(self): rules += [f"{rule}{ext}" for rule in [self.compiler_to_pch_rule_name(compiler)] for ext in ['', '_RSP']] # Add custom MIL link rules to get the files compiled by the TASKING compiler family to MIL files included in the database - if compiler.get_id() in set('cctc', 'ccarm', 'cc51', 'ccmsc', 'ccpcp'): + if compiler.get_id() in set(('cctc', 'ccarm', 'cc51', 'ccmsc', 'ccpcp')): rules += [f"{rule}{ext}" for rule in [self.get_compiler_rule_name('tasking_mil_compile', compiler.for_machine)] for ext in ['', '_RSP']] compdb_options = ['-x'] if mesonlib.version_compare(self.ninja_version, '>=1.9') else [] @@ -1058,9 +1058,11 @@ def generate_target(self, target): if isinstance(target, build.StaticLibrary): if target.prelink: final_obj_list = self.generate_prelink(target, obj_list) - elif linker.id in set('artc', 'ararm', 'ar51', 'armcs', 'arpcp'): + elif linker.id in set(('artc', 'ararm', 'ar51', 'armcs', 'arpcp')): if target.get_option(OptionKey('b_tasking_mil_link')): final_obj_list = self.generate_mil_link(target, obj_list) + else: + final_obj_list = obj_list else: final_obj_list = obj_list else: @@ -2625,7 +2627,7 @@ def generate_compile_rules(self): for langname, compiler in clist.items(): if compiler.get_id() == 'clang': self.generate_llvm_ir_compile_rule(compiler) - if compiler.get_id() == 'cctc' or compiler.get_id() == 'ccarm' or compiler.get_id() == 'cc51' or compiler.get_id() == 'ccmsc' or compiler.get_id() == 'ccpcp': + if compiler.get_id() in set(('cctc', 'ccarm', 'cc51', 'ccmsc', 'ccpcp')): self.generate_tasking_mil_compile_rules(compiler) self.generate_tasking_mil_link_rules(compiler) self.generate_compile_rule_for(langname, compiler) @@ -3065,7 +3067,7 @@ def generate_single_compile(self, target: build.BuildTarget, src, raise InvalidArguments(f'Invalid source type: {src!r}') obj_basename = self.object_filename_from_source(target, src) # If mil linking is enabled for the target, then compilation output has to be MIL files instead of object files - if compiler.get_id() == 'cctc' or compiler.get_id() == 'ccarm' or compiler.get_id() == 'cc51' or compiler.get_id() == 'ccmsc' or compiler.get_id() == 'ccpcp': + if compiler.get_id() in set(('cctc', 'ccarm', 'cc51', 'ccmsc', 'ccpcp')): if target.get_option(OptionKey('b_tasking_mil_link')) and src.endswith('.c'): if obj_basename.endswith('.o'): obj_basename = obj_basename[:-1] + 'mil' @@ -3094,7 +3096,7 @@ def generate_single_compile(self, target: build.BuildTarget, src, # If TASKING compiler family is used and MIL linking is enabled for the target, # then compilation rule name is a special one to output MIL files # instead of object files for .c files - if compiler.get_id() == 'cctc' or compiler.get_id() == 'ccarm' or compiler.get_id() == 'cc51' or compiler.get_id() == 'ccmsc' or compiler.get_id() == 'ccpcp': + if compiler.get_id() in set(('cctc', 'ccarm', 'cc51', 'ccmsc', 'ccpcp')): if target.get_option(OptionKey('b_tasking_mil_link')) and src.endswith('.c'): compiler_name = self.get_compiler_rule_name('tasking_mil_compile', compiler.for_machine) else: