From 539f1432cdc301e2f7b9c8109bcc25f5c38cad78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bence=20Sz=C3=A9pk=C3=BAti?= Date: Wed, 12 May 2021 10:28:30 +0200 Subject: [PATCH] Remove caching of cc_is_msvc 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 | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/mbedtls_dev/c_build_helper.py b/scripts/mbedtls_dev/c_build_helper.py index 833db465f..18c1e7606 100644 --- a/scripts/mbedtls_dev/c_build_helper.py +++ b/scripts/mbedtls_dev/c_build_helper.py @@ -89,7 +89,6 @@ int main(void) } ''') -_cc_is_msvc = None #pylint: disable=invalid-name def get_c_expression_values( cast_to, printf_format, expressions, @@ -113,9 +112,6 @@ def get_c_expression_values( to ``cc``. If ``CC`` looks like MSVC, use its command line syntax, otherwise assume the compiler supports Unix traditional ``-I`` and ``-o``. - NOTE: This function only checks the identity of the compiler referred to by - ``CC`` on its first invocation, and caches the result. - Return the list of values of the ``expressions``. """ if include_path is None: @@ -135,17 +131,15 @@ def get_c_expression_values( cc = os.getenv('CC', 'cc') cmd = [cc] - global _cc_is_msvc #pylint: disable=global-statement,invalid-name - if _cc_is_msvc is None: - proc = subprocess.Popen(cmd, - stdout=subprocess.DEVNULL, - stderr=subprocess.PIPE, - universal_newlines=True) - _cc_is_msvc = 'Microsoft (R) C/C++ Optimizing Compiler' in \ - proc.communicate()[1] + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL, + stderr=subprocess.PIPE, + universal_newlines=True) + cc_is_msvc = 'Microsoft (R) C/C++ Optimizing Compiler' in \ + proc.communicate()[1] cmd += ['-I' + dir for dir in include_path] - if _cc_is_msvc: + 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'