From 46d894925dfa4f06fbae719dc43d2eddf4aeed1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Wed, 12 May 2021 10:11:53 +0200 Subject: [PATCH] Move object file handling out of create_c_file() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bence Szépkúti --- scripts/mbedtls_dev/c_build_helper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mbedtls_dev/c_build_helper.py b/scripts/mbedtls_dev/c_build_helper.py index d02deb35a4..54c4e93d11 100644 --- a/scripts/mbedtls_dev/c_build_helper.py +++ b/scripts/mbedtls_dev/c_build_helper.py @@ -45,11 +45,9 @@ def create_c_file(file_label): suffix='.c') exe_suffix = '.exe' if platform.system() == 'Windows' else '' exe_name = c_name[:-2] + exe_suffix - obj_name = c_name[:-2] + '.obj' remove_file_if_exists(exe_name) - remove_file_if_exists(obj_name) c_file = os.fdopen(c_fd, 'w', encoding='ascii') - return c_file, c_name, exe_name, obj_name + return c_file, c_name, exe_name def generate_c_printf_expressions(c_file, cast_to, printf_format, expressions): """Generate C instructions to print the value of ``expressions``. @@ -124,8 +122,9 @@ def get_c_expression_values( include_path = [] c_name = None exe_name = None + obj_name = None try: - c_file, c_name, exe_name, obj_name = create_c_file(file_label) + c_file, c_name, exe_name = create_c_file(file_label) generate_c_file( c_file, caller, header, lambda c_file: generate_c_printf_expressions(c_file, @@ -149,6 +148,7 @@ def get_c_expression_values( if _cc_is_msvc: # MSVC has deprecated using -o to specify the output file, # and produces an object file in the working directory by default. + obj_name = exe_name[:-4] + '.obj' cmd += ['-Fe' + exe_name, '-Fo' + obj_name] else: cmd += ['-o' + exe_name]