Specify output name for MSVC as well

The output file was being created in the working directory, instead of
the temp directory.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
Bence Szépkúti 2021-05-06 15:14:16 +02:00 committed by Gilles Peskine
parent d2968bd122
commit cabae3d29e

View file

@ -95,7 +95,7 @@ def get_c_expression_values(
caller=__name__, file_label='', caller=__name__, file_label='',
header='', include_path=None, header='', include_path=None,
keep_c=False, keep_c=False,
): # pylint: disable=too-many-arguments ): # pylint: disable=too-many-arguments, too-many-locals
"""Generate and run a program to print out numerical values for expressions. """Generate and run a program to print out numerical values for expressions.
* ``cast_to``: a C type. * ``cast_to``: a C type.
@ -131,10 +131,9 @@ def get_c_expression_values(
cc_is_msvc = ('\\' + cc).lower().endswith('\\cl.exe') cc_is_msvc = ('\\' + cc).lower().endswith('\\cl.exe')
cmd = [cc] cmd = [cc]
cmd += ['-I' + dir for dir in include_path] cmd += ['-I' + dir for dir in include_path]
# MSVC doesn't support -o to specify the output file, but we use its # MSVC has deprecated using -o to specify the output file.
# default output file name. output_opt = '-Fe' if cc_is_msvc else '-o'
if not cc_is_msvc: cmd += [output_opt + exe_name]
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'