-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[runtimes] Rename the %{flags} Lit substitution to %{common_flags} #172931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ldionne
wants to merge
1
commit into
llvm:main
Choose a base branch
from
ldionne:review/rename-to-common-flags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These flags are common to compilation and linking, so %{common_flags}
makes more sense.
You can test this locally with the following command:darker --check --diff -r origin/main...HEAD libcxx/test/benchmarks/spec.gen.py libcxx/test/libcxx-03/module_std.gen.py libcxx/test/libcxx-03/module_std_compat.gen.py libcxx/test/libcxx/module_std.gen.py libcxx/test/libcxx/module_std_compat.gen.py libcxx/utils/libcxx/test/config.py libcxx/utils/libcxx/test/dsl.py libcxx/utils/libcxx/test/format.py
View the diff from darker here.--- test/benchmarks/spec.gen.py 2025-12-19 00:19:33.000000 +0000
+++ test/benchmarks/spec.gen.py 2025-12-19 00:21:03.445044 +0000
@@ -20,20 +20,21 @@
import json
import pathlib
import sys
test_dir = pathlib.Path(sys.argv[1])
-cxx = (test_dir / 'cxx.subs').open().read().strip()
-compile_flags = (test_dir / 'compile_flags.subs').open().read().strip()
-common_flags = (test_dir / 'common_flags.subs').open().read().strip()
-link_flags = (test_dir / 'link_flags.subs').open().read().strip()
-spec_dir = pathlib.Path((test_dir / 'spec_dir.subs').open().read().strip())
+cxx = (test_dir / "cxx.subs").open().read().strip()
+compile_flags = (test_dir / "compile_flags.subs").open().read().strip()
+common_flags = (test_dir / "common_flags.subs").open().read().strip()
+link_flags = (test_dir / "link_flags.subs").open().read().strip()
+spec_dir = pathlib.Path((test_dir / "spec_dir.subs").open().read().strip())
# Setup the configuration file
test_dir.mkdir(parents=True, exist_ok=True)
-spec_config = test_dir / 'spec-config.cfg'
-spec_config.write_text(f"""
+spec_config = test_dir / "spec-config.cfg"
+spec_config.write_text(
+ f"""
default:
ignore_errors = 1
iterations = 1
label = spec-stdlib
log_line_width = 4096
@@ -48,11 +49,12 @@
CC = cc -O3 -std=c18 -Wno-implicit-function-declaration
CXX = {cxx} {compile_flags} {common_flags} {link_flags} -Wno-error
CC_VERSION_OPTION = --version
CXX_VERSION_OPTION = --version
EXTRA_PORTABILITY = -DSPEC_NO_CXX17_SPECIAL_MATH_FUNCTIONS # because libc++ doesn't implement the special math functions yet
-""")
+"""
+)
# Build the list of benchmarks. We take all intrate and fprate benchmarks that contain C++ and
# discard the ones that contain Fortran, since this test suite isn't set up to build Fortran code.
spec_benchmarks = set()
no_fortran = set()
--- utils/libcxx/test/config.py 2025-12-19 00:19:33.000000 +0000
+++ utils/libcxx/test/config.py 2025-12-19 00:21:03.506917 +0000
@@ -49,10 +49,17 @@
action.pretty(config, lit_config.params), feature.pretty(config)
)
)
# Print the basic substitutions
- for sub in ("%{cxx}", "%{common_flags}", "%{compile_flags}", "%{link_flags}", "%{benchmark_flags}", "%{exec}"):
+ for sub in (
+ "%{cxx}",
+ "%{common_flags}",
+ "%{compile_flags}",
+ "%{link_flags}",
+ "%{benchmark_flags}",
+ "%{exec}",
+ ):
note("Using {} substitution: '{}'".format(sub, _getSubstitution(sub, config)))
# Print all available features
note("All available features: {}".format(", ".join(sorted(config.available_features))))
--- utils/libcxx/test/format.py 2025-12-19 00:19:33.000000 +0000
+++ utils/libcxx/test/format.py 2025-12-19 00:21:03.803778 +0000
@@ -29,11 +29,18 @@
return tmpDir, tmpBase
def _checkBaseSubstitutions(substitutions):
substitutions = [s for (s, _) in substitutions]
- for s in ["%{cxx}", "%{compile_flags}", "%{link_flags}", "%{benchmark_flags}", "%{common_flags}", "%{exec}"]:
+ for s in [
+ "%{cxx}",
+ "%{compile_flags}",
+ "%{link_flags}",
+ "%{benchmark_flags}",
+ "%{common_flags}",
+ "%{exec}",
+ ]:
assert s in substitutions, "Required substitution {} was not provided".format(s)
def _executeScriptInternal(test, litConfig, commands):
"""
Returns (stdout, stderr, exitCode, timeoutInfo, parsedCommands), or an appropriate lit.Test.Result
@@ -92,11 +99,14 @@
# errors, which doesn't make sense for clang-verify tests because we may want to check
# for specific warning diagnostics.
_checkBaseSubstitutions(substitutions)
substitutions.append(("%{temp}", tmpDir))
substitutions.append(
- ("%{build}", "%{cxx} %s %{common_flags} %{compile_flags} %{link_flags} -o %t.exe")
+ (
+ "%{build}",
+ "%{cxx} %s %{common_flags} %{compile_flags} %{link_flags} -o %t.exe",
+ )
)
substitutions.append(
(
"%{verify}",
"%{cxx} %s %{common_flags} %{compile_flags} -U_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -fsyntax-only -Wno-error -Xclang -verify -Xclang -verify-ignore-unexpected=note -ferror-limit=0",
|
philnik777
approved these changes
Dec 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These flags are common to compilation and linking, so %{common_flags} makes more sense.