mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
[libc++][NFC] Reformat features.py
This file was reformatted using the Black tool, which led to entirely unreadable code due to how lines are broken. Formatting tools are fine, but not when they lead to code that humans have trouble reading. In the case of features.py, a lot of it was meant to be aligned in a repetitive but consistent way to make the structure of the code stand out. Reformatting with the tool lost that property. Differential Revision: https://reviews.llvm.org/D152737
This commit is contained in:
parent
520c7fbbd0
commit
52310ce9c1
@ -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),
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user