diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2026-05-25 17:53:42 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2026-08-20 09:24:57 +0200 |
| commit | 0836a79adafe9c5089839621ac761f84b92e95cf (patch) | |
| tree | 1e165042b3d5fc931c9c49ed289fccb37f82ab05 /scripts | |
| parent | aac1b59b8577fc939c297025886a44d25bd635c3 (diff) | |
| download | qemu-0836a79adafe9c5089839621ac761f84b92e95cf.tar.gz qemu-0836a79adafe9c5089839621ac761f84b92e95cf.zip | |
scripts: remove now dead parts of rustc_args.py
The logic to parse the [lints] section has been integrated
into Meson and can be removed.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/rust/rustc_args.py | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/scripts/rust/rustc_args.py b/scripts/rust/rustc_args.py index 8098053720..107b944c16 100644 --- a/scripts/rust/rustc_args.py +++ b/scripts/rust/rustc_args.py @@ -25,10 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. """ import argparse -from dataclasses import dataclass import logging from pathlib import Path -from typing import Any, Iterable, List, Mapping, Optional, Set +from typing import Any, Iterable, Mapping, Optional, Set try: import tomllib @@ -74,40 +73,6 @@ class CargoTOML: return table -@dataclass -class LintFlag: - flags: List[str] - priority: int - - -def generate_lint_flags(cargo_toml: CargoTOML) -> Iterable[str]: - """Converts Cargo.toml lints to rustc -A/-D/-F/-W flags.""" - - toml_lints = cargo_toml.lints - - lint_list = [] - for k, v in toml_lints.items(): - prefix = "" if k == "rust" else k + "::" - for lint, data in v.items(): - level = data if isinstance(data, str) else data["level"] - priority = 0 if isinstance(data, str) else data.get("priority", 0) - if level == "deny": - flag = "-D" - elif level == "allow": - flag = "-A" - elif level == "warn": - flag = "-W" - elif level == "forbid": - flag = "-F" - else: - raise Exception(f"invalid level {level} for {prefix}{lint}") - lint_list.append(LintFlag(flags=[flag, prefix + lint], priority=priority)) - - lint_list.sort(key=lambda x: x.priority) - for lint in lint_list: - yield from lint.flags - - def generate_cfg_flags(header: str, cargo_toml: CargoTOML) -> Iterable[str]: """Converts defines from config[..].h headers to rustc --cfg flags.""" @@ -154,60 +119,17 @@ def main() -> None: required=False, default=None, ) - parser.add_argument( - "--features", - action="store_true", - dest="features", - help="generate --check-cfg arguments for features", - required=False, - default=None, - ) - parser.add_argument( - "--lints", - action="store_true", - dest="lints", - help="generate arguments from [lints] table", - required=False, - default=None, - ) - parser.add_argument( - "--rustc-version", - metavar="VERSION", - dest="rustc_version", - action="store", - help="version of rustc", - required=False, - default="1.0.0", - ) args = parser.parse_args() if args.verbose: logging.basicConfig(level=logging.DEBUG) logging.debug("args: %s", args) - rustc_version = tuple((int(x) for x in args.rustc_version.split('.')[0:2])) if args.workspace: workspace_cargo_toml = Path(args.workspace, "Cargo.toml").resolve() cargo_toml = CargoTOML(args.cargo_toml, str(workspace_cargo_toml)) else: cargo_toml = CargoTOML(args.cargo_toml, None) - if args.lints: - for tok in generate_lint_flags(cargo_toml): - print(tok) - - if rustc_version >= (1, 80): - if args.lints: - print("--check-cfg") - print("cfg(test)") - for cfg in sorted(cargo_toml.check_cfg): - print("--check-cfg") - print(cfg) - if args.features: - for feature in cargo_toml.get_table("features"): - if feature != "default": - print("--check-cfg") - print(f'cfg(feature,values("{feature}"))') - for header in args.config_headers: for tok in generate_cfg_flags(header, cargo_toml): print(tok) |
