diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index 082e6e79a500..26ffb16262cf 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -13,29 +13,17 @@ import shutil import subprocess import sys -_isClang = lambda cfg: "__clang__" in compilerMacros( - cfg -) and "__apple_build_version__" not in compilerMacros(cfg) +_isClang = lambda cfg: "__clang__" in compilerMacros(cfg) and "__apple_build_version__" not in compilerMacros(cfg) _isAppleClang = lambda cfg: "__apple_build_version__" in compilerMacros(cfg) -_isGCC = lambda cfg: "__GNUC__" in compilerMacros( - cfg -) and "__clang__" not in compilerMacros(cfg) +_isGCC = lambda cfg: "__GNUC__" in compilerMacros(cfg) and "__clang__" not in compilerMacros(cfg) _isMSVC = lambda cfg: "_MSC_VER" in compilerMacros(cfg) -_msvcVersion = lambda cfg: ( - int(compilerMacros(cfg)["_MSC_VER"]) // 100, - int(compilerMacros(cfg)["_MSC_VER"]) % 100, -) +_msvcVersion = lambda cfg: (int(compilerMacros(cfg)["_MSC_VER"]) // 100, int(compilerMacros(cfg)["_MSC_VER"]) % 100) def _getSuitableClangTidy(cfg): try: # If we didn't build the libcxx-tidy plugin via CMake, we can't run the clang-tidy tests. - if ( - runScriptExitCode( - cfg, ["stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin"] - ) - != 0 - ): + if runScriptExitCode(cfg, ["stat %{test-tools}/clang_tidy_checks/libcxx-tidy.plugin"]) != 0: return None # TODO MODULES require ToT due module specific fixes. @@ -48,14 +36,7 @@ def _getSuitableClangTidy(cfg): return "clang-tidy-16" # LLVM RELEASE bump version - if ( - int( - re.search( - "[0-9]+", commandOutput(cfg, ["clang-tidy --version"]) - ).group() - ) - >= 16 - ): + if int(re.search("[0-9]+", commandOutput(cfg, ["clang-tidy --version"])).group()) >= 16: return "clang-tidy" except ConfigurationRuntimeError: @@ -237,8 +218,7 @@ DEFAULT_FEATURES = [ # manages to find binaries to execute. Feature( name="executor-has-no-bash", - when=lambda cfg: runScriptExitCode(cfg, ["%{exec} bash -c 'bash --version'"]) - != 0, + when=lambda cfg: runScriptExitCode(cfg, ["%{exec} bash -c 'bash --version'"]) != 0, ), Feature( name="has-clang-tidy", @@ -253,15 +233,11 @@ DEFAULT_FEATURES = [ when=_isAppleClang, ), Feature( - name=lambda cfg: "apple-clang-{__clang_major__}.{__clang_minor__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "apple-clang-{__clang_major__}.{__clang_minor__}".format(**compilerMacros(cfg)), when=_isAppleClang, ), Feature( - name=lambda cfg: "apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "apple-clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}".format(**compilerMacros(cfg)), when=_isAppleClang, ), Feature(name="clang", when=_isClang), @@ -270,15 +246,11 @@ DEFAULT_FEATURES = [ when=_isClang, ), Feature( - name=lambda cfg: "clang-{__clang_major__}.{__clang_minor__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "clang-{__clang_major__}.{__clang_minor__}".format(**compilerMacros(cfg)), when=_isClang, ), Feature( - name=lambda cfg: "clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "clang-{__clang_major__}.{__clang_minor__}.{__clang_patchlevel__}".format(**compilerMacros(cfg)), when=_isClang, ), # Note: Due to a GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104760), we must disable deprecation warnings @@ -301,15 +273,11 @@ DEFAULT_FEATURES = [ name=lambda cfg: "gcc-{__GNUC__}".format(**compilerMacros(cfg)), when=_isGCC ), Feature( - name=lambda cfg: "gcc-{__GNUC__}.{__GNUC_MINOR__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "gcc-{__GNUC__}.{__GNUC_MINOR__}".format(**compilerMacros(cfg)), when=_isGCC, ), Feature( - name=lambda cfg: "gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}".format( - **compilerMacros(cfg) - ), + name=lambda cfg: "gcc-{__GNUC__}.{__GNUC_MINOR__}.{__GNUC_PATCHLEVEL__}".format(**compilerMacros(cfg)), when=_isGCC, ), Feature(name="msvc", when=_isMSVC), @@ -344,8 +312,7 @@ macros = { for macro, feature in macros.items(): DEFAULT_FEATURES.append( Feature( - name=lambda cfg, m=macro, f=feature: f - + ("={}".format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ""), + name=lambda cfg, m=macro, f=feature: f + ("={}".format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ""), when=lambda cfg, m=macro: m in compilerMacros(cfg), ) )