diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -73,6 +73,7 @@ return None +# fmt: off DEFAULT_PARAMETERS = [ Parameter( name="target_triple", @@ -108,15 +109,11 @@ type=bool, default=False, help="Whether to build the test suite with Clang modules enabled.", - actions=lambda modules: [ + actions=lambda modules: [] if not modules else [ AddFeature("modules-build"), AddCompileFlag("-fmodules"), - AddCompileFlag( - "-fcxx-modules" - ), # AppleClang disregards -fmodules entirely when compiling C++. This enables modules for C++. - ] - if modules - else [], + AddCompileFlag("-fcxx-modules"), # AppleClang disregards -fmodules entirely when compiling C++. This enables modules for C++. + ], ), Parameter( name="enable_modules_lsv", @@ -124,11 +121,9 @@ type=bool, default=False, help="Whether to enable Local Submodule Visibility in the Modules build.", - actions=lambda lsv: [ + actions=lambda lsv: [] if not lsv else [ AddCompileFlag("-Xclang -fmodules-local-submodule-visibility"), - ] - if lsv - else [], + ], ), Parameter( name="enable_exceptions", @@ -136,9 +131,10 @@ type=bool, default=True, help="Whether to enable exceptions when compiling the test suite.", - actions=lambda exceptions: [] - if exceptions - else [AddFeature("no-exceptions"), AddCompileFlag("-fno-exceptions")], + actions=lambda exceptions: [] if exceptions else [ + AddFeature("no-exceptions"), + AddCompileFlag("-fno-exceptions") + ], ), Parameter( name="enable_rtti", @@ -146,9 +142,10 @@ type=bool, default=True, help="Whether to enable RTTI when compiling the test suite.", - actions=lambda rtti: [] - if rtti - else [AddFeature("no-rtti"), AddCompileFlag("-fno-rtti")], + actions=lambda rtti: [] if rtti else [ + AddFeature("no-rtti"), + AddCompileFlag("-fno-rtti") + ], ), Parameter( name="stdlib", @@ -175,9 +172,7 @@ AddFeature("stdlib={}".format(stdlib)), # Also add an umbrella feature 'stdlib=libc++' for all flavors of libc++, to simplify # the test suite. - AddFeature("stdlib=libc++") - if re.match(".+-libc\+\+", stdlib) - else None, + AddFeature("stdlib=libc++") if re.match(".+-libc\+\+", stdlib) else None, ], ), ), @@ -187,10 +182,9 @@ type=bool, default=True, help="Whether to enable warnings when compiling the test suite.", - actions=lambda warnings: [] - if not warnings - else [AddOptionalWarningFlag(w) for w in _warningFlags] - + [AddCompileFlag("-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER")], + actions=lambda warnings: [] if not warnings else + [AddOptionalWarningFlag(w) for w in _warningFlags] + + [AddCompileFlag("-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER")], ), Parameter( name="use_sanitizer", @@ -212,35 +206,29 @@ None, [ AddFlag("-g -fno-omit-frame-pointer") if sanitizer else None, - AddFlag( - "-fsanitize=undefined -fno-sanitize=float-divide-by-zero -fno-sanitize-recover=all" - ) - if sanitizer == "Undefined" - else None, - AddFeature("ubsan") if sanitizer == "Undefined" else None, + + AddFlag("-fsanitize=undefined -fno-sanitize=float-divide-by-zero -fno-sanitize-recover=all") if sanitizer == "Undefined" else None, + AddFeature("ubsan") if sanitizer == "Undefined" else None, + AddFlag("-fsanitize=address") if sanitizer == "Address" else None, - AddFeature("asan") if sanitizer == "Address" else None, + AddFeature("asan") if sanitizer == "Address" else None, + AddFlag("-fsanitize=hwaddress") if sanitizer == "HWAddress" else None, - AddFeature("hwasan") if sanitizer == "HWAddress" else None, - AddFlag("-fsanitize=memory") - if sanitizer in ["Memory", "MemoryWithOrigins"] - else None, - AddFeature("msan") - if sanitizer in ["Memory", "MemoryWithOrigins"] - else None, - AddFlag("-fsanitize-memory-track-origins") - if sanitizer == "MemoryWithOrigins" - else None, + AddFeature("hwasan") if sanitizer == "HWAddress" else None, + + AddFlag("-fsanitize=memory") if sanitizer in ["Memory", "MemoryWithOrigins"] else None, + AddFeature("msan") if sanitizer in ["Memory", "MemoryWithOrigins"] else None, + AddFlag("-fsanitize-memory-track-origins") if sanitizer == "MemoryWithOrigins" else None, + AddFlag("-fsanitize=thread") if sanitizer == "Thread" else None, - AddFeature("tsan") if sanitizer == "Thread" else None, + AddFeature("tsan") if sanitizer == "Thread" else None, + AddFlag("-fsanitize=dataflow") if sanitizer == "DataFlow" else None, - AddFlag("-fsanitize=leaks") if sanitizer == "Leaks" else None, - AddFeature("sanitizer-new-delete") - if sanitizer - in ["Address", "HWAddress", "Memory", "MemoryWithOrigins", "Thread"] - else None, - ], - ), + AddFlag("-fsanitize=leaks") if sanitizer == "Leaks" else None, + + AddFeature("sanitizer-new-delete") if sanitizer in ["Address", "HWAddress", "Memory", "MemoryWithOrigins", "Thread"] else None, + ] + ) ), Parameter( name="enable_experimental", @@ -255,11 +243,7 @@ # We can't check for the feature 'msvc' in available_features # as those features are added after processing parameters. AddFeature("c++experimental"), - PrependLinkFlag( - lambda cfg: "-llibc++experimental" - if _isMSVC(cfg) - else "-lc++experimental" - ), + PrependLinkFlag(lambda cfg: "-llibc++experimental" if _isMSVC(cfg) else "-lc++experimental"), AddCompileFlag("-D_LIBCPP_ENABLE_EXPERIMENTAL"), ] if experimental @@ -282,12 +266,10 @@ default=False, help="Whether to enable assertions when compiling the test suite. This is only meaningful when " "running the tests against libc++.", - actions=lambda assertions: [ + actions=lambda assertions: [] if not assertions else [ AddCompileFlag("-D_LIBCPP_ENABLE_ASSERTIONS=1"), AddFeature("libcpp-has-assertions"), - ] - if assertions - else [], + ], ), Parameter( name="additional_features", @@ -306,11 +288,10 @@ help="Whether to enable backwards-compatibility transitive includes when running the tests. This " "is provided to ensure that the trimmed-down version of libc++ does not bit-rot in between " "points at which we bulk-remove transitive includes.", - actions=lambda enabled: [] - if enabled - else [ + actions=lambda enabled: [] if enabled else [ AddFeature("transitive-includes-disabled"), AddCompileFlag("-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES"), ], ), ] +# fmt: on