mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
Clean up object files produced by MSVC
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
parent
fa6bf1e588
commit
24c29fe7c3
@ -45,9 +45,11 @@ def create_c_file(file_label):
|
|||||||
suffix='.c')
|
suffix='.c')
|
||||||
exe_suffix = '.exe' if platform.system() == 'Windows' else ''
|
exe_suffix = '.exe' if platform.system() == 'Windows' else ''
|
||||||
exe_name = c_name[:-2] + exe_suffix
|
exe_name = c_name[:-2] + exe_suffix
|
||||||
|
obj_name = c_name[:-2] + '.obj'
|
||||||
remove_file_if_exists(exe_name)
|
remove_file_if_exists(exe_name)
|
||||||
|
remove_file_if_exists(obj_name)
|
||||||
c_file = os.fdopen(c_fd, 'w', encoding='ascii')
|
c_file = os.fdopen(c_fd, 'w', encoding='ascii')
|
||||||
return c_file, c_name, exe_name
|
return c_file, c_name, exe_name, obj_name
|
||||||
|
|
||||||
def generate_c_printf_expressions(c_file, cast_to, printf_format, expressions):
|
def generate_c_printf_expressions(c_file, cast_to, printf_format, expressions):
|
||||||
"""Generate C instructions to print the value of ``expressions``.
|
"""Generate C instructions to print the value of ``expressions``.
|
||||||
@ -120,7 +122,7 @@ def get_c_expression_values(
|
|||||||
c_name = None
|
c_name = None
|
||||||
exe_name = None
|
exe_name = None
|
||||||
try:
|
try:
|
||||||
c_file, c_name, exe_name = create_c_file(file_label)
|
c_file, c_name, exe_name, obj_name = create_c_file(file_label)
|
||||||
generate_c_file(
|
generate_c_file(
|
||||||
c_file, caller, header,
|
c_file, caller, header,
|
||||||
lambda c_file: generate_c_printf_expressions(c_file,
|
lambda c_file: generate_c_printf_expressions(c_file,
|
||||||
@ -141,15 +143,20 @@ def get_c_expression_values(
|
|||||||
proc.communicate()[1]
|
proc.communicate()[1]
|
||||||
|
|
||||||
cmd += ['-I' + dir for dir in include_path]
|
cmd += ['-I' + dir for dir in include_path]
|
||||||
# MSVC has deprecated using -o to specify the output file.
|
if _cc_is_msvc:
|
||||||
output_opt = '-Fe' if _cc_is_msvc else '-o'
|
# MSVC has deprecated using -o to specify the output file,
|
||||||
cmd += [output_opt + exe_name]
|
# and produces an object file in the working directory by default.
|
||||||
|
cmd += ['-Fe' + exe_name, '-Fo' + obj_name]
|
||||||
|
else:
|
||||||
|
cmd += ['-o' + exe_name]
|
||||||
subprocess.check_call(cmd + [c_name])
|
subprocess.check_call(cmd + [c_name])
|
||||||
if keep_c:
|
if keep_c:
|
||||||
sys.stderr.write('List of {} tests kept at {}\n'
|
sys.stderr.write('List of {} tests kept at {}\n'
|
||||||
.format(caller, c_name))
|
.format(caller, c_name))
|
||||||
else:
|
else:
|
||||||
os.remove(c_name)
|
os.remove(c_name)
|
||||||
|
if _cc_is_msvc:
|
||||||
|
os.remove(obj_name)
|
||||||
output = subprocess.check_output([exe_name])
|
output = subprocess.check_output([exe_name])
|
||||||
return output.decode('ascii').strip().split('\n')
|
return output.decode('ascii').strip().split('\n')
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user