From patchwork Thu Jul 7 16:37:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HpTwAE5y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Gf1fDKz9s2R for ; Fri, 8 Jul 2022 02:40:58 +1000 (AEST) Received: from localhost ([::1]:41378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9UYh-0008Tg-Mn for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:40:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVv-0008R8-D7 for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVd-0006mw-BX for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=REOeu0JYcGJ3o0Um/tFxTMzk2rEnBZmjsx4mEK39gZs=; b=HpTwAE5y+8llnjsrcMYPxH3+M/ptjnrL9Yz9tyqlPK63abr48nNfRKBiphx4dRPPj/nrNN sMMp5L6tL8SYwi09ghMQNjuUcc4VONJzJ7Q+25gh1DAgqW4iEM00msiK/bqJtQL0kgA1uJ KE77R//NXcqPdGJXWp8usaXiFWR4LrQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-196-pFTYQ3gQNtCzM6ASXaZs5Q-1; Thu, 07 Jul 2022 12:37:41 -0400 X-MC-Unique: pFTYQ3gQNtCzM6ASXaZs5Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F8AC8C59AB; Thu, 7 Jul 2022 16:37:25 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBAAF40315C; Thu, 7 Jul 2022 16:37:23 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 1/9] tests: introduce tree-wide code style checking Date: Thu, 7 Jul 2022 17:37:12 +0100 Message-Id: <20220707163720.1421716-2-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Historically QEMU has used the 'scripts/checkpatch.pl' script to validate various style rules but there are a number of issues: - Contributors / maintainers are reluctant to add new tests to it, nor fix existint rules, because the Perl code is much too hard to understand for most people. - It requires the contributor to remember to run it as it is not wired into 'make check' - While it can be told to check whole files, in practice it is usually only used to check patch diffs, because the former would flag up pages of pre-existing violations that have never been fixed - It is said to be OK to ignore some things reported by the script, but don't record these exceptional cases anywere. Thus contributors looking at existing violations in tree are never sure whether they are intentional or historical unfixed technical debt. - There is no distinct reporting for each type of check performed and as a consequence there is also no way to mark particular files to be skipped for particular checks This commit aims to give us a better approach to checking many types of code style problems by introducing a flexible and simple way to define whole tree style checks. The logic provide is inspired by the GNULIB 'top/maint.mk' file, but has been re-implemented in a simple Python script, using a YAML config file, in an attempt to make it easier to understand than the make rules. This commit does the bare minimum introducing the basic infra: - tests/style.py - the script for evaluating coding style rules - tests/style.yml - the config defining the coding style rules The concept behind the style checking is to perform simple regular expression matches across the source file content. The key benefit of regular expression matching is that it is very fast, and can match against all types of source file in the repository, regardless of whether it is used in the current build, or the language the source is written in. The downside, compared to a compiler based approach (eg libclang) is that it does not have semantic understanding of the code, which makes some checks difficult to implement. As such this style matching framework is not proposed as a solution for all possible coding style rules. It is general enough that it can accomplish many useful checks, and is intended to be complimentary to any style checkers with semantic knowledge of the code like libclang, or pylint/flake8. It would be possible to use Python's regular expression engine to perform this matching directly, it instead calls out to 'grep' (for single line matches) and 'perl' (for multiline matches). These are highly optimized regex engines, so should maximise performance. They also avoid problems with python's charset encoding causing it to throw exceptions when encountering invalid utf8, rather than continue on a best effort basis. In terms of defining checks, a short bit of yaml is all that is required. For example, consider we want to stop people using the 'bool' type entirely in C source files. A rule in tests/style.yml would say prohibit_bool: files: \.c$ prohibit: \bbool\b message: do not use the bool type The 'prohibit' rule is matched line-wise across every .c source file. If any violation is found, the contents of that line are printed, and 'message' is shown as a error message. There are many more advanced options, which are documented in comments in the style.yml file in this commit. The tool can be invoked directly ./tests/style.py --config test/style.yml check Or for individual checks ./tests/style.py --config test/style.yml check --rule prohibit_bool If a file is known to intentionally violate a style check rule this can be recorded in the style.yml and will result in it being ignored. The '--ignored' flag can be used to see ignored failures. This is all wired up into meson, such that a 'style' test suite is defined and each individual style check is exposed as a test case. This results in creation of a 'make check-style' target that is triggerd by 'make check' by default. Note that the checks require the use of 'git' to detect the list of source files to search. Thus the check is skipped when not running from a git repository. Signed-off-by: Daniel P. Berrangé --- meson.build | 2 + tests/Makefile.include | 3 +- tests/meson.build | 17 ++++ tests/style.py | 218 +++++++++++++++++++++++++++++++++++++++++ tests/style.yml | 88 +++++++++++++++++ 5 files changed, 327 insertions(+), 1 deletion(-) create mode 100755 tests/style.py create mode 100644 tests/style.yml diff --git a/meson.build b/meson.build index 65a885ea69..d8ef24bacb 100644 --- a/meson.build +++ b/meson.build @@ -18,6 +18,8 @@ config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') enable_modules = 'CONFIG_MODULES' in config_host enable_static = 'CONFIG_STATIC' in config_host +in_gitrepo = run_command('test', '-d', '.git', check: false).returncode() == 0 + # Allow both shared and static libraries unless --enable-static static_kwargs = enable_static ? {'static': true} : {} diff --git a/tests/Makefile.include b/tests/Makefile.include index 3accb83b13..f7c1d2644e 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -3,12 +3,13 @@ .PHONY: check-help check-help: @echo "Regression testing targets:" - @echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests" + @echo " $(MAKE) check Run block, qapi-schema, unit, style, softfloat, qtest and decodetree tests" @echo " $(MAKE) bench Run speed tests" @echo @echo "Individual test suites:" @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" @echo " $(MAKE) check-qtest Run qtest tests" + @echo " $(MAKE) check-style Run style checks" @echo " $(MAKE) check-unit Run qobject tests" @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" @echo " $(MAKE) check-block Run block tests" diff --git a/tests/meson.build b/tests/meson.build index 8e318ec513..f3140428c3 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -89,6 +89,23 @@ if get_option('tcg').allowed() endif endif +if in_gitrepo + stylecmd = files('style.py') + stylecfg = files('style.yml') + + checks = run_command( + stylecmd, '--config', stylecfg, 'list', + check: true) + + foreach check: checks.stdout().strip().split() + test(check, + stylecmd, + args: [ '--config', stylecfg, 'check', '--rule', check ], + workdir: meson.project_source_root(), + suite: 'style') + endforeach +endif + subdir('unit') subdir('qapi-schema') subdir('qtest') diff --git a/tests/style.py b/tests/style.py new file mode 100755 index 0000000000..a6c05bbb32 --- /dev/null +++ b/tests/style.py @@ -0,0 +1,218 @@ +#!/usr/bin/python + +import argparse +import re +import subprocess +import sys +import time +import yaml + + +def source_files(): + src = subprocess.check_output( + ["git", "ls-tree", "--name-only", "-r", "HEAD:"]) + + return src.decode("utf8").strip().split("\n") + + +# Expand a regular expression from the config file which +# can be in several formats +# +# - a plain string - used as-is as a regular expression +# - a list of strings - each element is joined with '|' +# - a dict containing +# - 'terms' - interpreted as a string / list of strings +# - 'prefix' - added to the front of the regular +# - 'prefix' - added to the end of the regular +# +# Returns: a regulare expression string +def expand_re(restr): + if restr is None: + return None + + if type(restr) == list: + return "|".join(restr) + + if type(restr) == dict: + terms = "(?:" + expand_re(restr["terms"]) + ")" + + return restr.get("prefix", "") + terms + restr.get("suffix", "") + + return restr + + +# Expand the regular expression and then compile it +# +# Returns: a compiled regular expresison object for matching +def compile_re(restr): + if restr is None: + return None + + return re.compile(expand_re(restr)) + + +# Take a list of source files and filter it returning a subset +# +# If @match is non-NULL, it is expanded as a regular expression +# and the source file name is included if-and-only-if it matches +# the regex. +# +# If @nonmatch is non-NULL, it is expanded as a regular expression +# and the source file name is excluded if-and-only-if it matches +# the regex. +# +# Returns: the filtered list of soruces +def filtered_sources(sources, match, nonmatch): + matchre = compile_re(match) + nonmatchre = compile_re(nonmatch) + + filtered = [] + for name in sources: + if ((matchre is None or matchre.search(name)) and + (nonmatchre is None or not nonmatchre.search(name))): + filtered.append(name) + return filtered + + +# Sanity check the configuration of a rule +# +# Returns: true if the rule is valid +def validate(name, rule): + if "prohibit" not in rule and "require" not in rule: + raise Exception("Either 'prohibit' or 'require' regex is needed") + + if "prohibit" in rule and "require" in rule: + raise Exception("Only one of 'prohibit' or 'require' regex is needed") + + +# Evalate the rule against the designated sources +# +# Returns: 1 if the rule failed against one or more sources, 0 otherwise +def evaluate(sources, name, rule, ignored=False): + if not rule.get("enabled", True): + return + + validate(name, rule) + + ignorere = None + if not ignored: + ignorere = rule.get("ignore") + + print("CHECK: %s: " % name, end='') + sources = filtered_sources(sources, + rule.get("files"), + ignorere) + + input = "\n".join(sources) + + then = time.time() + + # For single line matching, 'grep' is most efficient, + # but it can't do the required multi-line matching + # so for the latter we turn to 'perl' + if not rule.get("multiline", False): + if "prohibit" in rule: + # The output is the list of lines that have invalid content + proc = subprocess.run(["xargs", "grep", "-nE", + expand_re(rule["prohibit"])], + input=input, capture_output=True, + encoding='utf8') + elif "require" in rule: + # The output is the list of filenames which don't have + # the required content + proc = subprocess.run(["xargs", "grep", "-LE", + expand_re(rule["require"])], + input=input, capture_output=True, + encoding='utf8') + else: + raise Exception("Unexpected rule config") + else: + if "prohibit" in rule: + # The output is the list of lines that have invalid content + proc = subprocess.run(["xargs", "perl", "-0777", "-ne", + (r'while (m,%s,gs) {' + \ + r' $n = ($` =~ tr/\n/\n/ + 1);' + \ + r' ($v = $&) =~ s/\n/\\n/g;' + \ + r' print "$ARGV:$n:$v\n";' +\ + r'}') % expand_re(rule["prohibit"])], + input=input, capture_output=True, + encoding='utf8') + elif "require" in rule: + # The output is the list of filenames which don't have + # the required content + proc = subprocess.run(["xargs", "perl", "-0777", "-ne", + ("unless (m,%s,s) {" + \ + " print \"$ARGV\n\";" + \ + "}") % expand_re(rule["require"])], + input=input, capture_output=True, + encoding='utf8') + else: + raise Exception("Unexpected rule config") + + if proc.returncode != 0: + raise Exception(proc.stderr) + + now = time.time() + delta = now - then + + if len(proc.stdout) > 0: + print("\033[31;1mFAIL\033[0m ❌ (%0.2f secs)" % delta) + print(proc.stdout.strip()) + print("\033[31;1mERROR\033[0m: %s: %s ❌" % (name, rule["message"])) + return 1 + else: + print("\033[32;1mPASS\033[0m ✅ (%0.2f secs)" % delta) + return 0 + + +def parse_args(): + parser = argparse.ArgumentParser("Code style checker") + parser.add_argument("--config", + default="tests/style.yml", + help="Path to style rules file") + + subparsers = parser.add_subparsers(dest="command") + subparsers.required = True + + list = subparsers.add_parser("list", help="list rules") + + check = subparsers.add_parser("check", help="check rules") + check.add_argument("--rule", + help="Name of rule to check") + check.add_argument("--ignored", + action="store_true", + help="Show intentionally ignored violations") + + return parser.parse_args() + + +def main(): + args = parse_args() + + sources = source_files() + + with open(args.config, "r") as fh: + rules = yaml.safe_load(fh) + if rules is None: + rules = {} + + if args.command == "list": + for name, rule in rules.items(): + if rule.get("enabled", True): + print(name) + elif args.command == "check": + errs = 0 + for name, rule in rules.items(): + if args.rule == None or args.rule == name: + errs += evaluate(sources, name, rule, args.ignored) + if errs: + return 1 + else: + raise Exception("unknown command '%s'" % args.command) + return 0 + +try: + sys.exit(main()) +except Exception as e: + print("ERROR: %s: %s" % (sys.argv[0], str(e))) + sys.exit(2) diff --git a/tests/style.yml b/tests/style.yml new file mode 100644 index 0000000000..b4e7c6111f --- /dev/null +++ b/tests/style.yml @@ -0,0 +1,88 @@ +# Source code style checking rules +# +# Each top level key defines a new check, that is +# exposed as a test case in the meson 'style' test +# suite. +# +# Within each check, the following keys are valid +# +# * files +# +# A regular expression matching filenames that +# are to be checked. Typically used to filter +# based on file extension. If omitted all files +# managed by git will be checked. +# +# * prohibit +# +# A regular expression matching content that is +# not allowed to be present in source files. Matches +# against single lines of text, unless 'multiline' +# option overrides. Either this option or 'require' +# must be present +# +# * require +# +# A regular expression matching content that must +# always be present in source files. Matches against +# single lines of text, unless 'multiline' option +# overrides. Either this option of 'prohibit' must +# be present +# +# * multiline +# +# A boolean controlling whether 'prohibit' and 'require' +# regular expressions match single lines or the entire +# file contents. Defaults to 'false', matching single +# lines at a time. +# +# * ignore +# +# A regular expression matching files to exclude from +# the check. This is typically used when certain files +# otherwise checked have known acceptable violations +# of the test. +# +# * message +# +# A string providing a message to emit when the test +# condition fails. Must be present +# +# * enabled +# +# A boolean providing a way to temporarily disable +# a check. Defaults to 'true' if omitted. +# +# For all the keys above which accept a regular expression, +# one of three syntaxes are permitted +# +# * string +# +# The full regular expression to match +# +# * list of strings +# +# Each element of the list will be combined with '|' +# to form the final regular expression. This is typically +# useful to keep line length short when specifying matches +# across many filenames +# +# * dict +# +# Contains the keys: +# +# * terms +# +# Either a string or list of strings interpreted as above +# +# * prefix +# +# A match added to the front of the regex. Useful when +# 'terms' is a list of strings and a common prefix is +# desired +# +# * suffix +# +# A match added to the front of the regex. Useful when +# 'terms' is a list of strings and a common prefix is +# desired From patchwork Thu Jul 7 16:37:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VWlO+Onj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2GZ1rH9z9s07 for ; Fri, 8 Jul 2022 02:40:52 +1000 (AEST) Received: from localhost ([::1]:41314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9UYa-0008Qj-Vr for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVm-0008QW-UI for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:37:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVh-0006n8-Me for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:37:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bMMjerKu54ASLmvNQKBsHfVmkcYnelUQhRuCMaz1ryw=; b=VWlO+Onj8Tj1+oE+5+0PPUYXywMvCy49iOKxa+1bI4MgWdPoMWN1oxDd/P9k2SNZiiPsID K98/FVwsr3DBK9k3Pi59woK/OHG1r0LEV1Ev/eNpT09GkOnloP3z8mdvmIqCqPtCdFHTJP bf9vI/Ad3wO6yVK9Y6ErF+TRn2fu8VM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-YdhMwuzeMzahxNCM1oeUbg-1; Thu, 07 Jul 2022 12:37:44 -0400 X-MC-Unique: YdhMwuzeMzahxNCM1oeUbg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C257D94B872; Thu, 7 Jul 2022 16:37:26 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A91C40315C; Thu, 7 Jul 2022 16:37:25 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 2/9] misc: fix mixups of bool constants with int variables Date: Thu, 7 Jul 2022 17:37:13 +0100 Message-Id: <20220707163720.1421716-3-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel P. Berrangé Reviewed-by: Peter Maydell --- block/vhdx-log.c | 2 +- hw/xtensa/sim.c | 4 ++-- nbd/client.c | 8 +++++--- target/i386/cpu-dump.c | 3 ++- ui/spice-display.c | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/block/vhdx-log.c b/block/vhdx-log.c index ff0d4e0da0..8f34755a6f 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -215,7 +215,7 @@ exit: static bool vhdx_log_hdr_is_valid(VHDXLogEntries *log, VHDXLogEntryHeader *hdr, BDRVVHDXState *s) { - int valid = false; + bool valid = false; if (hdr->signature != VHDX_LOG_SIGNATURE) { goto exit; diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 946c71cb5b..70fce7fb85 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -97,9 +97,9 @@ void xtensa_sim_load_kernel(XtensaCPU *cpu, MachineState *machine) { const char *kernel_filename = machine->kernel_filename; #if TARGET_BIG_ENDIAN - int big_endian = true; + int big_endian = 1; #else - int big_endian = false; + int big_endian = 0; #endif if (kernel_filename) { diff --git a/nbd/client.c b/nbd/client.c index 30d5383cb1..637811fc3f 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -832,8 +832,8 @@ static int nbd_list_meta_contexts(QIOChannel *ioc, Error **errp) { int ret; - int seen_any = false; - int seen_qemu = false; + bool seen_any = false; + bool seen_qemu = false; if (nbd_send_meta_query(ioc, NBD_OPT_LIST_META_CONTEXT, info->name, NULL, errp) < 0) { @@ -863,7 +863,9 @@ static int nbd_list_meta_contexts(QIOChannel *ioc, return ret; } seen_any = true; - seen_qemu |= strstart(context, "qemu:", NULL); + if (strstart(context, "qemu:", NULL)) { + seen_qemu = true; + } info->contexts = g_renew(char *, info->contexts, ++info->n_contexts); info->contexts[info->n_contexts - 1] = context; } diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c index 08ac957e99..43521c74c8 100644 --- a/target/i386/cpu-dump.c +++ b/target/i386/cpu-dump.c @@ -275,7 +275,8 @@ static void dump_apic_icr(APICCommonState *s, CPUX86State *env) static void dump_apic_interrupt(const char *name, uint32_t *ireg_tab, uint32_t *tmr_tab) { - int i, empty = true; + int i; + bool empty = true; qemu_printf("%s\t ", name); for (i = 0; i < 256; i++) { diff --git a/ui/spice-display.c b/ui/spice-display.c index 494168e7fe..5d3b64413f 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -541,14 +541,14 @@ static int interface_get_command(QXLInstance *sin, QXLCommandExt *ext) { SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl); SimpleSpiceUpdate *update; - int ret = false; + int ret = 0; qemu_mutex_lock(&ssd->lock); update = QTAILQ_FIRST(&ssd->updates); if (update != NULL) { QTAILQ_REMOVE(&ssd->updates, update, next); *ext = update->ext; - ret = true; + ret = 1; } qemu_mutex_unlock(&ssd->lock); From patchwork Thu Jul 7 16:37:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bkNE1Hyt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Gd662sz9s07 for ; Fri, 8 Jul 2022 02:40:57 +1000 (AEST) Received: from localhost ([::1]:41422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9UYe-0008WJ-Dz for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:40:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UW2-0008TW-4s for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVp-0006p7-JI for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=92ftO/Uz7aiapJeO9mt9EgQoLeAj8kyjXGC5hIrV/4w=; b=bkNE1Hytwpo6uq/FzMjjv8WYxx+VgmpL5l55gGLqJSLWiwI7S/wZoEPCEYQaGe5Ycr9eZ1 Lmc3mt+6QZLAgrFlMiwxn9VkFkvjzDMcjiNAg/52ygKbW/ChSM9pbXj+cWmHiRRK+VUEJS RJ+T6w7P/g44M8kdb31DTp93jPABCZo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-TeflL_L-MOy-3Mt14G6zdQ-1; Thu, 07 Jul 2022 12:37:49 -0400 X-MC-Unique: TeflL_L-MOy-3Mt14G6zdQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 549EB383329C; Thu, 7 Jul 2022 16:37:28 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E091492C3B; Thu, 7 Jul 2022 16:37:26 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 3/9] tests/style: check for mixups of bool constants with int variables Date: Thu, 7 Jul 2022 17:37:14 +0100 Message-Id: <20220707163720.1421716-4-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The 'true' and 'false' constants should only ever be used with the 'bool' type, never 'int'. Signed-off-by: Daniel P. Berrangé --- tests/style.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/style.yml b/tests/style.yml index b4e7c6111f..704227d8e9 100644 --- a/tests/style.yml +++ b/tests/style.yml @@ -86,3 +86,8 @@ # A match added to the front of the regex. Useful when # 'terms' is a list of strings and a common prefix is # desired + +int_assign_bool: + files: \.c$ + prohibit: \.*= *(true|false)\b + message: use bool type for boolean values From patchwork Thu Jul 7 16:37:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AwPbThc9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Vb73HGz9s07 for ; Fri, 8 Jul 2022 02:51:19 +1000 (AEST) Received: from localhost ([::1]:35826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9Uih-0007Fe-4H for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:51:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UWr-0000Y1-9B for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:39:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UWZ-0006s8-V6 for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nIlI/wJNt1TqK9jh2sy6FenOIjCGpe55NB3t5Af2nqM=; b=AwPbThc9oL6+bEp3cess9CFqlOiH5/6OZslkeY+HpX+rRlnFvHOD8qzVVD/cRTR3iDOU+c tKspHfOHrKS7pA3az516iEcWAIjINCaUZD33kNzNmp4C3OiU6AnUfHaII+7klZxGvOQ51e mCv/ReZhDW7Lf+jx7r2OZJUZXQ3XeY8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-477--oPmTWxOMjKwFj-Ci7lt0w-1; Thu, 07 Jul 2022 12:38:14 -0400 X-MC-Unique: -oPmTWxOMjKwFj-Ci7lt0w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E75AF940469; Thu, 7 Jul 2022 16:37:29 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B73B492C3B; Thu, 7 Jul 2022 16:37:28 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 4/9] misc: fix commonly doubled up words Date: Thu, 7 Jul 2022 17:37:15 +0100 Message-Id: <20220707163720.1421716-5-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Daniel P. Berrangé Reviewed-by: Peter Maydell --- block/linux-aio.c | 2 +- block/qcow2-bitmap.c | 8 ++++---- contrib/plugins/cache.c | 2 +- disas/libvixl/vixl/invalset.h | 2 +- docs/devel/qom.rst | 4 ++-- docs/interop/live-block-operations.rst | 4 ++-- docs/system/arm/cpu-features.rst | 2 +- docs/system/devices/cxl.rst | 2 +- docs/system/s390x/bootdevices.rst | 2 +- docs/system/tls.rst | 2 +- docs/tools/qemu-pr-helper.rst | 4 ++-- hw/core/clock.c | 2 +- hw/intc/arm_gicv3_redist.c | 2 +- hw/misc/iotkit-secctl.c | 2 +- hw/misc/iotkit-sysctl.c | 4 ++-- hw/s390x/s390-ccw.c | 2 +- hw/usb/u2f.h | 2 +- include/hw/qdev-core.h | 2 +- include/user/safe-syscall.h | 2 +- linux-user/i386/cpu_loop.c | 2 +- pc-bios/s390-ccw/virtio-scsi.c | 2 +- python/Makefile | 2 +- python/qemu/utils/__init__.py | 2 +- target/arm/translate.c | 2 +- target/i386/cpu.c | 2 +- tcg/i386/tcg-target.c.inc | 2 +- tests/qtest/microbit-test.c | 6 +++--- tools/virtiofsd/fuse_virtio.c | 2 +- 28 files changed, 37 insertions(+), 37 deletions(-) diff --git a/block/linux-aio.c b/block/linux-aio.c index 9c2393a2f7..d2cfb7f523 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -461,7 +461,7 @@ LinuxAioState *laio_init(Error **errp) s = g_malloc0(sizeof(*s)); rc = event_notifier_init(&s->e, false); if (rc < 0) { - error_setg_errno(errp, -rc, "failed to to initialize event notifier"); + error_setg_errno(errp, -rc, "failed to initialize event notifier"); goto out_free_state; } diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 8fb4731551..5529368df4 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -787,10 +787,10 @@ static int bitmap_list_store(BlockDriverState *bs, Qcow2BitmapList *bm_list, } } - /* Actually, even in in-place case ignoring QCOW2_OL_BITMAP_DIRECTORY is not - * necessary, because we drop QCOW2_AUTOCLEAR_BITMAPS when updating bitmap - * directory in-place (actually, turn-off the extension), which is checked - * in qcow2_check_metadata_overlap() */ + /* Actually, even in the in-place case ignoring QCOW2_OL_BITMAP_DIRECTORY + * is not necessary, because we drop QCOW2_AUTOCLEAR_BITMAPS when updating + * bitmap directory in-place (actually, turn-off the extension), which is + * checked in qcow2_check_metadata_overlap() */ ret = qcow2_pre_write_overlap_check( bs, in_place ? QCOW2_OL_BITMAP_DIRECTORY : 0, dir_offset, dir_size, false); diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index b9226e7c40..ac1510aaa1 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -38,7 +38,7 @@ enum EvictionPolicy policy; * put in any of the blocks inside the set. The number of block per set is * called the associativity (assoc). * - * Each block contains the the stored tag and a valid bit. Since this is not + * Each block contains the stored tag and a valid bit. Since this is not * a functional simulator, the data itself is not stored. We only identify * whether a block is in the cache or not by searching for its tag. * diff --git a/disas/libvixl/vixl/invalset.h b/disas/libvixl/vixl/invalset.h index 2e0871f8c3..f5d6c43d81 100644 --- a/disas/libvixl/vixl/invalset.h +++ b/disas/libvixl/vixl/invalset.h @@ -102,7 +102,7 @@ template class InvalSet { size_t size() const; // Returns true if no elements are stored in the set. - // Note that this does not mean the the backing storage is empty: it can still + // Note that this does not mean the backing storage is empty: it can still // contain invalid elements. bool empty() const; diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst index e5fe3597cd..62c39c9c88 100644 --- a/docs/devel/qom.rst +++ b/docs/devel/qom.rst @@ -372,8 +372,8 @@ This accepts an array of interface type names. { TYPE_USER_CREATABLE }, { NULL }) -If the type is not intended to be instantiated, then then -the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: +If the type is not intended to be instantiated, then the +OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: .. code-block:: c :caption: Defining a simple abstract type diff --git a/docs/interop/live-block-operations.rst b/docs/interop/live-block-operations.rst index 39e62c9915..135784ab33 100644 --- a/docs/interop/live-block-operations.rst +++ b/docs/interop/live-block-operations.rst @@ -53,7 +53,7 @@ files in a disk image backing chain: (1) Directional: 'base' and 'top'. Given the simple disk image chain above, image [A] can be referred to as 'base', and image [B] as - 'top'. (This terminology can be seen in in QAPI schema file, + 'top'. (This terminology can be seen in the QAPI schema file, block-core.json.) (2) Relational: 'backing file' and 'overlay'. Again, taking the same @@ -825,7 +825,7 @@ entire disk image chain, to a target, using ``blockdev-mirror`` would be: job ready to be completed (5) Gracefully complete the 'mirror' block device job, and notice the - the event ``BLOCK_JOB_COMPLETED`` + event ``BLOCK_JOB_COMPLETED`` (6) Shutdown the guest by issuing the QMP ``quit`` command so that caches are flushed diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst index 3fd76fa0b4..c2c01ec7d2 100644 --- a/docs/system/arm/cpu-features.rst +++ b/docs/system/arm/cpu-features.rst @@ -284,7 +284,7 @@ SVE CPU Property Parsing Semantics CPU Property Dependencies and Constraints"). 4) If one or more vector lengths have been explicitly enabled and at - at least one of the dependency lengths of the maximum enabled length + least one of the dependency lengths of the maximum enabled length has been explicitly disabled, then an error is generated (see constraint (2) of "SVE CPU Property Dependencies and Constraints"). diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index a57e4c4e5c..36031325cc 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -15,7 +15,7 @@ with CXL Host Bridges, which have CXL Root Ports which may be directly attached to CXL or PCI End Points. Alternatively there may be CXL Switches with CXL and PCI Endpoints attached below them. In many cases additional control and capabilities are exposed via PCI Express interfaces. -This sharing of interfaces and hence emulation code is is reflected +This sharing of interfaces and hence emulation code is reflected in how the devices are emulated in QEMU. In most cases the various CXL elements are built upon an equivalent PCIe devices. diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst index 9e591cb9dc..b5950133e8 100644 --- a/docs/system/s390x/bootdevices.rst +++ b/docs/system/s390x/bootdevices.rst @@ -65,7 +65,7 @@ you can specify it via the ``-global s390-ipl.netboot_fw=filename`` command line option. The ``bootindex`` property is especially important for booting via the network. -If you don't specify the the ``bootindex`` property here, the network bootloader +If you don't specify the ``bootindex`` property here, the network bootloader firmware code won't get loaded into the guest memory so that the network boot will fail. For a successful network boot, try something like this:: diff --git a/docs/system/tls.rst b/docs/system/tls.rst index 1a04674362..e284c82801 100644 --- a/docs/system/tls.rst +++ b/docs/system/tls.rst @@ -182,7 +182,7 @@ certificates. --template client-hostNNN.info \ --outfile client-hostNNN-cert.pem -The subject alt name extension data is not required for clients, so the +The subject alt name extension data is not required for clients, so the ``dns_name`` and ``ip_address`` fields are not included. The ``tls_www_client`` keyword is the key purpose extension to indicate this certificate is intended for usage in a web client. Although QEMU network diff --git a/docs/tools/qemu-pr-helper.rst b/docs/tools/qemu-pr-helper.rst index eaebe40da0..c32867cfc6 100644 --- a/docs/tools/qemu-pr-helper.rst +++ b/docs/tools/qemu-pr-helper.rst @@ -21,8 +21,8 @@ programs because incorrect usage can disrupt regular operation of the storage fabric. QEMU's SCSI passthrough devices ``scsi-block`` and ``scsi-generic`` support passing guest persistent reservation requests to a privileged external helper program. :program:`qemu-pr-helper` -is that external helper; it creates a socket which QEMU can -connect to to communicate with it. +is that external helper; it creates a listener socket which will +accept incoming connections for communication with QEMU. If you want to run VMs in a setup like this, this helper should be started as a system service, and you should read the QEMU manual diff --git a/hw/core/clock.c b/hw/core/clock.c index 916875e07a..d82e44cd1a 100644 --- a/hw/core/clock.c +++ b/hw/core/clock.c @@ -68,7 +68,7 @@ static uint64_t clock_get_child_period(Clock *clk) { /* * Return the period to be used for child clocks, which is the parent - * clock period adjusted for for multiplier and divider effects. + * clock period adjusted for multiplier and divider effects. */ return muldiv64(clk->period, clk->multiplier, clk->divider); } diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index f1ecb2502b..c92ceecc16 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -492,7 +492,7 @@ static MemTxResult gicr_writel(GICv3CPUState *cs, hwaddr offset, return MEMTX_OK; case GICR_WAKER: /* Only the ProcessorSleep bit is writable. When the guest sets - * it it requests that we transition the channel between the + * it, it requests that we transition the channel between the * redistributor and the cpu interface to quiescent, and that * we set the ChildrenAsleep bit once the inteface has reached the * quiescent state. diff --git a/hw/misc/iotkit-secctl.c b/hw/misc/iotkit-secctl.c index 7b41cfa8fc..b5a9e30a2c 100644 --- a/hw/misc/iotkit-secctl.c +++ b/hw/misc/iotkit-secctl.c @@ -114,7 +114,7 @@ static const uint8_t iotkit_secctl_ns_sse300_idregs[] = { * AHB expansion, APB expansion) are all set up so that they are * in 16-aligned blocks so offsets 0xN0, 0xN4, 0xN8, 0xNC are PPCs * 0, 1, 2, 3 of that type, so we can convert a register address offset - * into an an index into a PPC array easily. + * into an index into a PPC array easily. */ static inline int offset_to_ppc_idx(uint32_t offset) { diff --git a/hw/misc/iotkit-sysctl.c b/hw/misc/iotkit-sysctl.c index 9ee8fe8495..7147e2f84e 100644 --- a/hw/misc/iotkit-sysctl.c +++ b/hw/misc/iotkit-sysctl.c @@ -237,7 +237,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->ewctrl; break; case ARMSSE_SSE300: - /* In SSE300 this offset is is NMI_ENABLE */ + /* In SSE300 this offset is NMI_ENABLE */ r = s->nmi_enable; break; default: @@ -555,7 +555,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->ewctrl = value; break; case ARMSSE_SSE300: - /* In SSE300 this offset is is NMI_ENABLE */ + /* In SSE300 this offset is NMI_ENABLE */ qemu_log_mask(LOG_UNIMP, "IoTKit SysCtl NMI_ENABLE unimplemented\n"); s->nmi_enable = value; break; diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c index 2fc8bb9c23..e2d86d96e7 100644 --- a/hw/s390x/s390-ccw.c +++ b/hw/s390x/s390-ccw.c @@ -57,7 +57,7 @@ IOInstEnding s390_ccw_store(SubchDev *sch) /* * This code is called for both virtual and passthrough devices, - * but only applies to to the latter. This ugly check makes that + * but only applies to the latter. This ugly check makes that * distinction for us. */ if (object_dynamic_cast(OBJECT(sch->driver_data), TYPE_S390_CCW)) { diff --git a/hw/usb/u2f.h b/hw/usb/u2f.h index db30f3586b..a408a82927 100644 --- a/hw/usb/u2f.h +++ b/hw/usb/u2f.h @@ -74,7 +74,7 @@ typedef struct U2FKeyState { /* * API to be used by the U2F key device variants (i.e. hw/u2f-*.c) - * to interact with the the U2F key base device (i.e. hw/u2f.c) + * to interact with the U2F key base device (i.e. hw/u2f.c) */ void u2f_send_to_guest(U2FKeyState *key, const uint8_t packet[U2FHID_PACKET_SIZE]); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 98774e2835..785dd5a56e 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -386,7 +386,7 @@ bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp); * * - unrealize any child buses by calling qbus_unrealize() * (this will recursively unrealize any devices on those buses) - * - call the the unrealize method of @dev + * - call the unrealize method of @dev * * The device can then be freed by causing its reference count to go * to zero. diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h index 61a04e2b5a..ddceef12e2 100644 --- a/include/user/safe-syscall.h +++ b/include/user/safe-syscall.h @@ -70,7 +70,7 @@ * If the host libc is used then the implementation will appear to work * most of the time, but there will be a race condition where a * signal could arrive just before we make the host syscall inside libc, - * and then then guest syscall will not correctly be interrupted. + * and then the guest syscall will not correctly be interrupted. * Instead the implementation of the guest syscall can use the safe_syscall * function but otherwise just return the result or errno in the usual * way; the main loop code will take care of restarting the syscall diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 492701dd9a..42837399bc 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -137,7 +137,7 @@ static void emulate_vsyscall(CPUX86State *env) } /* - * Validate the the pointer arguments. + * Validate the pointer arguments. */ switch (syscall) { case TARGET_NR_gettimeofday: diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index 2c8d0f3097..45256b3fdb 100644 --- a/pc-bios/s390-ccw/virtio-scsi.c +++ b/pc-bios/s390-ccw/virtio-scsi.c @@ -195,7 +195,7 @@ static bool scsi_read_capacity(VDev *vdev, /* virtio-scsi routines */ /* - * Tries to locate a SCSI device and and adds the information for the found + * Tries to locate a SCSI device and adds the information for the found * device to the vdev->scsi_device structure. * Returns 0 if SCSI device could be located, or a error code < 0 otherwise */ diff --git a/python/Makefile b/python/Makefile index 3334311362..b170708398 100644 --- a/python/Makefile +++ b/python/Makefile @@ -29,7 +29,7 @@ help: @echo " Performs no environment setup of any kind." @echo "" @echo "make develop:" - @echo " Install deps needed for for 'make check'," + @echo " Install deps needed for 'make check'," @echo " and install the qemu package in editable mode." @echo " (Can be used in or outside of a venv.)" @echo "" diff --git a/python/qemu/utils/__init__.py b/python/qemu/utils/__init__.py index 9fb273b13d..017cfdcda7 100644 --- a/python/qemu/utils/__init__.py +++ b/python/qemu/utils/__init__.py @@ -79,7 +79,7 @@ def add_visual_margin( :param content: The text to wrap and decorate. :param width: The number of columns to use, including for the decoration - itself. The default (None) uses the the available width of the + itself. The default (None) uses the available width of the current terminal, or a fallback of 72 lines. A negative number subtracts a fixed-width from the default size. The default obeys the COLUMNS environment variable, if set. diff --git a/target/arm/translate.c b/target/arm/translate.c index 6617de775f..73d1faf917 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8056,7 +8056,7 @@ static TCGv_i32 op_addr_block_pre(DisasContext *s, arg_ldst_block *a, int n) * If the writeback is incrementing SP rather than * decrementing it, and the initial SP is below the * stack limit but the final written-back SP would - * be above, then then we must not perform any memory + * be above, then we must not perform any memory * accesses, but it is IMPDEF whether we generate * an exception. We choose to do so in this case. * At this point 'addr' is the lowest address, so diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 6a57ef13af..194b5a31af 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3632,7 +3632,7 @@ static const X86CPUDefinition builtin_x86_defs[] = { CPUID_7_0_EDX_CORE_CAPABILITY, .features[FEAT_CORE_CAPABILITY] = MSR_CORE_CAP_SPLIT_LOCK_DETECT, - /* XSAVES is is added in version 3 */ + /* XSAVES is added in version 3 */ .features[FEAT_XSAVE] = CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | CPUID_XSAVE_XGETBV1, diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index d52206ba4d..cb04e4b3ad 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1652,7 +1652,7 @@ static void tcg_out_branch(TCGContext *s, int call, const tcg_insn_unit *dest) } else { /* rip-relative addressing into the constant pool. This is 6 + 8 = 14 bytes, as compared to using an - an immediate load 10 + 6 = 16 bytes, plus we may + immediate load 10 + 6 = 16 bytes, plus we may be able to re-use the pool constant for more calls. */ tcg_out_opc(s, OPC_GRP5, 0, 0, 0); tcg_out8(s, (call ? EXT5_CALLN_Ev : EXT5_JMPN_Ev) << 3 | 5); diff --git a/tests/qtest/microbit-test.c b/tests/qtest/microbit-test.c index 04e199ec33..b71daae9a9 100644 --- a/tests/qtest/microbit-test.c +++ b/tests/qtest/microbit-test.c @@ -447,11 +447,11 @@ static void test_nrf51_timer(void) timer_set_bitmode(qts, NRF51_TIMER_WIDTH_16); /* 16 MHz Timer */ timer_set_prescaler(qts, 0); - /* Swept over in first step */ + /* Swept over, during the first step */ timer_set_cc(qts, 0, 2); - /* Barely miss on first step */ + /* Barely miss, after the second step */ timer_set_cc(qts, 1, 162); - /* Spot on on third step */ + /* Spot on, after the third step */ timer_set_cc(qts, 2, 480); timer_assert_events(qts, 0, 0, 0, 0); diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index a52eacf82e..9368e292e4 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -379,7 +379,7 @@ int virtio_send_data_iov(struct fuse_session *se, struct fuse_chan *ch, copy_iov(iov, count, in_sg, in_num, iov_len); /* - * Build a copy of the the in_sg iov so we can skip bits in it, + * Build a copy of the in_sg iov so we can skip bits in it, * including changing the offsets */ in_sg_cpy = g_new(struct iovec, in_num); From patchwork Thu Jul 7 16:37:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fdnPrFZo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Lg6mkhz9s07 for ; Fri, 8 Jul 2022 02:44:27 +1000 (AEST) Received: from localhost ([::1]:49596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9Uc5-0005sK-MD for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:44:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UW2-0008UL-52 for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40160) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVp-0006nr-CZ for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5K2S0LswOphsaHudz/nfJSDJC4MuQQIoZkbgm3JRDig=; b=fdnPrFZodAUh8rufrgNnqarJ9YKd8J2IbBN9hGSLe2Y1UXnHz6xcPZohR1pvNh6dKavZYa 1f2OolFPCl4J5Nh15saYnAOMgTs8Z4e8QN681JNqA4XP93AwNlvvdLtnyR/r8W18M148b1 zl7slPX+vbn2gP7QQx9Rmn26RmhJKQw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-mzX1WXhcMHelPb8oIYLGgw-1; Thu, 07 Jul 2022 12:37:51 -0400 X-MC-Unique: mzX1WXhcMHelPb8oIYLGgw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7173F1833BE7; Thu, 7 Jul 2022 16:37:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30A23492C3B; Thu, 7 Jul 2022 16:37:30 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 5/9] tests/style: check for commonly doubled up words Date: Thu, 7 Jul 2022 17:37:16 +0100 Message-Id: <20220707163720.1421716-6-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This style check looks for cases where the words the then in an on if is it but for or at and do to are repeated in a sentence. It uses a multi-line match to catch the especially common mistake in docs where the last word on a line is repeated as the first word of the next line. There are inevitably be some false positives with this check, for example, some docs data tables have the same word in adjacent columns. There are a few different ways to express this text as a regex which have wildly different execution time. This impl was carefully chosen to attempt to minimize matching time. Signed-off-by: Daniel P. Berrangé --- tests/style.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/style.yml b/tests/style.yml index 704227d8e9..d06c55bb29 100644 --- a/tests/style.yml +++ b/tests/style.yml @@ -91,3 +91,33 @@ int_assign_bool: files: \.c$ prohibit: \.*= *(true|false)\b message: use bool type for boolean values + +double_words: + multiline: true + prohibit: + terms: + - the\s+the + - then\s+then + - in\s+in + - an\s+an + - on\s+on + - if\s+if + - is\s+is + - it\s+it + - but\s+but + - for\s+for + - or\s+or + - at\s+at + - and\s+and + - do\s+do + - to\s+to + - can\s+can + prefix: \b(? X-Patchwork-Id: 1653706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MMD9I0wy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2R23scbz9s07 for ; Fri, 8 Jul 2022 02:48:13 +1000 (AEST) Received: from localhost ([::1]:58302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9Ufi-0003Hd-Fk for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:48:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UW1-0008TX-0T for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53851) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVs-0006pj-SG for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=07uLczDlambja7CzBYzFBorf8YjPmc4em0jNKKJjDkA=; b=MMD9I0wytWK0eUyyRBhG6MDg9rTshbPgmO/OwEd+OYiovmJonNsKmcIUCPnEvIEY6pVrUi jmz0CICq+pAXR730gerVAG85kpkuPyKPW1zUgOrvkMh0wkVS4MGk+DaGuZsef/aAVIVypU RyNTqA2JjekA4ofuOhTtDDx6blczjZs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-425-WS43NHp8PtSMAj8Jwx_Hbw-1; Thu, 07 Jul 2022 12:37:55 -0400 X-MC-Unique: WS43NHp8PtSMAj8Jwx_Hbw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6ABDD940490; Thu, 7 Jul 2022 16:37:33 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF19E492C3B; Thu, 7 Jul 2022 16:37:31 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 6/9] misc: ensure qemu/osdep.h is included first in all .c files Date: Thu, 7 Jul 2022 17:37:17 +0100 Message-Id: <20220707163720.1421716-7-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" A few files relied on qemu/osdep.h being included via a common header. Others didn't need it because they were actually an included file, so ought to have been named '.c.inc'. Finally some didn't have it as the first header included. Signed-off-by: Daniel P. Berrangé --- backends/hostmem-epc.c | 4 +++- block/export/vduse-blk.c | 3 ++- bsd-user/arm/signal.c | 2 ++ bsd-user/arm/target_arch_cpu.c | 3 +++ bsd-user/{elfcore.c => elfcore.c.inc} | 0 bsd-user/elfload.c | 2 +- bsd-user/freebsd/os-sys.c | 2 ++ bsd-user/i386/signal.c | 2 ++ bsd-user/i386/target_arch_cpu.c | 3 ++- bsd-user/main.c | 3 ++- bsd-user/qemu.h | 1 - bsd-user/x86_64/signal.c | 2 ++ bsd-user/x86_64/target_arch_cpu.c | 3 ++- crypto/rsakey.c | 1 + hw/hyperv/syndbg.c | 2 +- qga/cutils.c | 2 ++ ...-enc-hextile-template.h => vnc-enc-hextile-template.c.inc} | 0 ui/vnc-enc-hextile.c | 4 ++-- ui/vnc-enc-zrle.c.inc | 2 +- ...nc-enc-zywrle-template.c => vnc-enc-zywrle-template.c.inc} | 0 util/mmap-alloc.c | 3 ++- 21 files changed, 32 insertions(+), 12 deletions(-) rename bsd-user/{elfcore.c => elfcore.c.inc} (100%) rename ui/{vnc-enc-hextile-template.h => vnc-enc-hextile-template.c.inc} (100%) rename ui/{vnc-enc-zywrle-template.c => vnc-enc-zywrle-template.c.inc} (100%) diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c index 037292d267..d88da98119 100644 --- a/backends/hostmem-epc.c +++ b/backends/hostmem-epc.c @@ -9,9 +9,11 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#include #include "qemu/osdep.h" + +#include + #include "qom/object_interfaces.h" #include "qapi/error.h" #include "sysemu/hostmem.h" diff --git a/block/export/vduse-blk.c b/block/export/vduse-blk.c index f101c24c3f..c251210251 100644 --- a/block/export/vduse-blk.c +++ b/block/export/vduse-blk.c @@ -10,9 +10,10 @@ * later. See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" + #include -#include "qemu/osdep.h" #include "qapi/error.h" #include "block/export.h" #include "qemu/error-report.h" diff --git a/bsd-user/arm/signal.c b/bsd-user/arm/signal.c index 2b1dd745d1..eca20ac4d7 100644 --- a/bsd-user/arm/signal.c +++ b/bsd-user/arm/signal.c @@ -17,6 +17,8 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include "qemu.h" /* diff --git a/bsd-user/arm/target_arch_cpu.c b/bsd-user/arm/target_arch_cpu.c index 02bf9149d5..186cf43fb9 100644 --- a/bsd-user/arm/target_arch_cpu.c +++ b/bsd-user/arm/target_arch_cpu.c @@ -16,6 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ + +#include "qemu/osdep.h" + #include "target_arch.h" void target_cpu_set_tls(CPUARMState *env, target_ulong newtls) diff --git a/bsd-user/elfcore.c b/bsd-user/elfcore.c.inc similarity index 100% rename from bsd-user/elfcore.c rename to bsd-user/elfcore.c.inc diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index f8edb22f2a..1717a454dc 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -121,7 +121,7 @@ static void bswap_note(struct elf_note *en) { } #endif /* ! BSWAP_NEEDED */ -#include "elfcore.c" +#include "elfcore.c.inc" /* * 'copy_elf_strings()' copies argument/envelope strings from user diff --git a/bsd-user/freebsd/os-sys.c b/bsd-user/freebsd/os-sys.c index 309e27b9d6..1eab1be6f6 100644 --- a/bsd-user/freebsd/os-sys.c +++ b/bsd-user/freebsd/os-sys.c @@ -17,6 +17,8 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include "qemu.h" #include "target_arch_sysarch.h" diff --git a/bsd-user/i386/signal.c b/bsd-user/i386/signal.c index 5dd975ce56..db5b774213 100644 --- a/bsd-user/i386/signal.c +++ b/bsd-user/i386/signal.c @@ -17,6 +17,8 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include "qemu.h" /* diff --git a/bsd-user/i386/target_arch_cpu.c b/bsd-user/i386/target_arch_cpu.c index d349e45299..bbe237f178 100644 --- a/bsd-user/i386/target_arch_cpu.c +++ b/bsd-user/i386/target_arch_cpu.c @@ -17,9 +17,10 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include -#include "qemu/osdep.h" #include "cpu.h" #include "qemu.h" #include "qemu/timer.h" diff --git a/bsd-user/main.c b/bsd-user/main.c index 6f09180d65..042afd0693 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -18,12 +18,13 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include #include #include #include -#include "qemu/osdep.h" #include "qemu/help-texts.h" #include "qemu/units.h" #include "qemu/accel.h" diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index be6105385e..0ceecfb6df 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -17,7 +17,6 @@ #ifndef QEMU_H #define QEMU_H -#include "qemu/osdep.h" #include "cpu.h" #include "qemu/units.h" #include "exec/cpu_ldst.h" diff --git a/bsd-user/x86_64/signal.c b/bsd-user/x86_64/signal.c index c3875bc4c6..217f9ceb66 100644 --- a/bsd-user/x86_64/signal.c +++ b/bsd-user/x86_64/signal.c @@ -16,6 +16,8 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include "qemu.h" /* diff --git a/bsd-user/x86_64/target_arch_cpu.c b/bsd-user/x86_64/target_arch_cpu.c index be7bd10720..e4746c7efe 100644 --- a/bsd-user/x86_64/target_arch_cpu.c +++ b/bsd-user/x86_64/target_arch_cpu.c @@ -17,9 +17,10 @@ * along with this program; if not, see . */ +#include "qemu/osdep.h" + #include -#include "qemu/osdep.h" #include "cpu.h" #include "qemu.h" #include "qemu/timer.h" diff --git a/crypto/rsakey.c b/crypto/rsakey.c index cc40e072f0..dcdbd9ec57 100644 --- a/crypto/rsakey.c +++ b/crypto/rsakey.c @@ -19,6 +19,7 @@ * */ +#include "qemu/osdep.h" #include "rsakey.h" void qcrypto_akcipher_rsakey_free(QCryptoAkCipherRSAKey *rsa_key) diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c index 16d04cfdc6..94fe1b534b 100644 --- a/hw/hyperv/syndbg.c +++ b/hw/hyperv/syndbg.c @@ -5,8 +5,8 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/ctype.h" #include "qemu/osdep.h" +#include "qemu/ctype.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/sockets.h" diff --git a/qga/cutils.c b/qga/cutils.c index b8e142ef64..c53dd418c7 100644 --- a/qga/cutils.c +++ b/qga/cutils.c @@ -2,6 +2,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ + +#include "qemu/osdep.h" #include "cutils.h" #include "qapi/error.h" diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.c.inc similarity index 100% rename from ui/vnc-enc-hextile-template.h rename to ui/vnc-enc-hextile-template.c.inc diff --git a/ui/vnc-enc-hextile.c b/ui/vnc-enc-hextile.c index 4215bd7daf..c8fee1e2f6 100644 --- a/ui/vnc-enc-hextile.c +++ b/ui/vnc-enc-hextile.c @@ -34,12 +34,12 @@ static void hextile_enc_cord(uint8_t *ptr, int x, int y, int w, int h) } #define BPP 32 -#include "vnc-enc-hextile-template.h" +#include "vnc-enc-hextile-template.c.inc" #undef BPP #define GENERIC #define BPP 32 -#include "vnc-enc-hextile-template.h" +#include "vnc-enc-hextile-template.c.inc" #undef BPP #undef GENERIC diff --git a/ui/vnc-enc-zrle.c.inc b/ui/vnc-enc-zrle.c.inc index c107d8affc..b7484aef00 100644 --- a/ui/vnc-enc-zrle.c.inc +++ b/ui/vnc-enc-zrle.c.inc @@ -66,7 +66,7 @@ static void ZRLE_ENCODE_TILE(VncState *vs, ZRLE_PIXEL *data, int w, int h, int zywrle_level); #if ZRLE_BPP != 8 -#include "vnc-enc-zywrle-template.c" +#include "vnc-enc-zywrle-template.c.inc" #endif diff --git a/ui/vnc-enc-zywrle-template.c b/ui/vnc-enc-zywrle-template.c.inc similarity index 100% rename from ui/vnc-enc-zywrle-template.c rename to ui/vnc-enc-zywrle-template.c.inc diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 5b90cb68ea..6c6a58da7f 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -10,6 +10,8 @@ * later. See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" + #ifdef CONFIG_LINUX #include #else /* !CONFIG_LINUX */ @@ -17,7 +19,6 @@ #define MAP_SHARED_VALIDATE 0x0 #endif /* CONFIG_LINUX */ -#include "qemu/osdep.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h" #include "qemu/cutils.h" From patchwork Thu Jul 7 16:37:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MFHHe/wB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Lq2dfBz9s07 for ; Fri, 8 Jul 2022 02:44:35 +1000 (AEST) Received: from localhost ([::1]:49944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9UcC-00066H-59 for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:44:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVw-0008Sj-8i for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVp-0006nk-CX for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SntZfyZnnODfKVkCXVO1fSkhca/EX/tEr2CvULvE+ms=; b=MFHHe/wByndJpGE1T/d6fv51+aynaDyxoqH7lCGL/HfixcV4DM7FpMpU+mqZxbr6dMxwLk HwYiQR2ItTnfwnIn/JObAGLIu8Id857SjQHdqANj/m6wK7FZSUAaHAHn2TU7/RUlUTX0Si UwvsL16G5ud06DbbDKcTwzDW34eiiEs= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-StqnwGDHNxSepUoDNZ1DKQ-1; Thu, 07 Jul 2022 12:37:51 -0400 X-MC-Unique: StqnwGDHNxSepUoDNZ1DKQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D86B1C1AD55; Thu, 7 Jul 2022 16:37:35 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id D43DE492C3B; Thu, 7 Jul 2022 16:37:33 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 7/9] tests/style: check qemu/osdep.h is included in all .c files Date: Thu, 7 Jul 2022 17:37:18 +0100 Message-Id: <20220707163720.1421716-8-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The qemu/osdep.h file must be included as the very first header in all C source files, to ensure its definitions take effect over all other header files, including system headers. Signed-off-by: Daniel P. Berrangé --- tests/style.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/style.yml b/tests/style.yml index d06c55bb29..6d91ac6115 100644 --- a/tests/style.yml +++ b/tests/style.yml @@ -120,4 +120,26 @@ double_words: - pc-bios/ - qemu-options\.hx - scripts/checkpatch\.pl - - tests/qtest/arm-cpu-features\.c \ No newline at end of file + - tests/qtest/arm-cpu-features\.c + +osdep_h_in_source: + multiline: true + files: \.c$ + require: ^((?!#include)[^\n]*\n)*#include "qemu/osdep.h" + message: all C source files must include qemu/osdep.h, as the first header + ignore: + - contrib/plugins/.* + - linux-user/(mips64|x86_64)/(signal|cpu_loop)\.c + - pc-bios/.* + - scripts/coverity-scan/model\.c + - scripts/xen-detect\.c + - subprojects/.* + - target/hexagon/(gen_semantics|gen_dectree_import)\.c + - target/s390x/gen-features\.c + - tests/migration/s390x/a-b-bios\.c + - tests/multiboot/.* + - tests/plugin/.* + - tests/tcg/.* + - tests/uefi-test-tools/.* + - tests/unit/test-rcu-(simpleq|slist|tailq)\.c + - tools/ebpf/rss.bpf.c From patchwork Thu Jul 7 16:37:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Or2ccf8p; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Lm1n03z9s07 for ; Fri, 8 Jul 2022 02:44:32 +1000 (AEST) Received: from localhost ([::1]:49840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9UcA-00062Y-0M for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UW3-00004s-Jm for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UW0-0006qT-AI for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=94FmLEdnOhdOk/AEHOilX4+G9s1K3ACK3kJoE45hdPE=; b=Or2ccf8pBohBQ0x7FUMK2DhU/MVlBPtBqvMKsn7GZPoCeu8aXGvd9gm0sa6USn9jj16nk0 m8PvbUuaComdNcFzmnT8jX8+AB/Ih/y8CSemmhtmlgB6is6GXPc/a7MJruBeqq1KEN6aWs BI2+iOCNzjuaaQqOAmmcgk8sF0sTZuc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-tN2iV9vNMdCzPFMElOQgrw-1; Thu, 07 Jul 2022 12:38:01 -0400 X-MC-Unique: tN2iV9vNMdCzPFMElOQgrw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E46EA280302D; Thu, 7 Jul 2022 16:37:36 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5926492C3B; Thu, 7 Jul 2022 16:37:35 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 8/9] misc: remove qemu/osdep.h from headers / included source files Date: Thu, 7 Jul 2022 17:37:19 +0100 Message-Id: <20220707163720.1421716-9-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since qemu/osdep.h is guaranteed present in all C source files, there is hno reason for it to be present in header files. Some C source files are not directly directly, but rather included from other source files. These should also not have qemu/osdep.h present, as the primary source will have already included it. --- crypto/akcipher-gcrypt.c.inc | 1 - crypto/akcipher-nettle.c.inc | 1 - crypto/cipher-gnutls.c.inc | 1 - crypto/rsakey-nettle.c.inc | 1 - crypto/rsakey.h | 1 - include/hw/cxl/cxl_host.h | 1 - include/hw/tricore/triboard.h | 1 - include/qemu/userfaultfd.h | 1 - net/vmnet_int.h | 1 - qga/cutils.h | 2 -- target/cris/translate_v10.c.inc | 1 - target/hexagon/hex_arch_types.h | 1 - target/hexagon/mmvec/macros.h | 1 - target/riscv/pmu.h | 1 - target/xtensa/core-dc232b/xtensa-modules.c.inc | 1 - target/xtensa/core-dc233c/xtensa-modules.c.inc | 1 - target/xtensa/core-de212/xtensa-modules.c.inc | 1 - target/xtensa/core-fsf/xtensa-modules.c.inc | 1 - target/xtensa/core-sample_controller/xtensa-modules.c.inc | 1 - ui/vnc-enc-zrle.c.inc | 3 --- ui/vnc-enc-zywrle-template.c.inc | 1 - 21 files changed, 24 deletions(-) diff --git a/crypto/akcipher-gcrypt.c.inc b/crypto/akcipher-gcrypt.c.inc index abb1fb272e..709f4167f6 100644 --- a/crypto/akcipher-gcrypt.c.inc +++ b/crypto/akcipher-gcrypt.c.inc @@ -21,7 +21,6 @@ #include -#include "qemu/osdep.h" #include "qemu/host-utils.h" #include "crypto/akcipher.h" #include "crypto/random.h" diff --git a/crypto/akcipher-nettle.c.inc b/crypto/akcipher-nettle.c.inc index 02699e6e6d..f36a9b5048 100644 --- a/crypto/akcipher-nettle.c.inc +++ b/crypto/akcipher-nettle.c.inc @@ -21,7 +21,6 @@ #include -#include "qemu/osdep.h" #include "qemu/host-utils.h" #include "crypto/akcipher.h" #include "crypto/random.h" diff --git a/crypto/cipher-gnutls.c.inc b/crypto/cipher-gnutls.c.inc index 501e4e07a5..c71fa16ed7 100644 --- a/crypto/cipher-gnutls.c.inc +++ b/crypto/cipher-gnutls.c.inc @@ -18,7 +18,6 @@ * */ -#include "qemu/osdep.h" #include "cipherpriv.h" #include diff --git a/crypto/rsakey-nettle.c.inc b/crypto/rsakey-nettle.c.inc index cc49872e78..f376552541 100644 --- a/crypto/rsakey-nettle.c.inc +++ b/crypto/rsakey-nettle.c.inc @@ -21,7 +21,6 @@ #include -#include "qemu/osdep.h" #include "qapi/error.h" #include "rsakey.h" diff --git a/crypto/rsakey.h b/crypto/rsakey.h index 974b76f659..ba88974d12 100644 --- a/crypto/rsakey.h +++ b/crypto/rsakey.h @@ -22,7 +22,6 @@ #ifndef QCRYPTO_RSAKEY_H #define QCRYPTO_RSAKEY_H -#include "qemu/osdep.h" #include "qemu/host-utils.h" #include "crypto/akcipher.h" diff --git a/include/hw/cxl/cxl_host.h b/include/hw/cxl/cxl_host.h index a1b662ce40..c9bc9c7c50 100644 --- a/include/hw/cxl/cxl_host.h +++ b/include/hw/cxl/cxl_host.h @@ -7,7 +7,6 @@ * COPYING file in the top-level directory. */ -#include "qemu/osdep.h" #include "hw/cxl/cxl.h" #include "hw/boards.h" diff --git a/include/hw/tricore/triboard.h b/include/hw/tricore/triboard.h index 094c8bd563..4fdd2d7d97 100644 --- a/include/hw/tricore/triboard.h +++ b/include/hw/tricore/triboard.h @@ -18,7 +18,6 @@ * License along with this library; if not, see . */ -#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/boards.h" #include "sysemu/sysemu.h" diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h index 6b74f92792..55c95998e8 100644 --- a/include/qemu/userfaultfd.h +++ b/include/qemu/userfaultfd.h @@ -13,7 +13,6 @@ #ifndef USERFAULTFD_H #define USERFAULTFD_H -#include "qemu/osdep.h" #include "exec/hwaddr.h" #include diff --git a/net/vmnet_int.h b/net/vmnet_int.h index adf6e8c20d..d0b90594f2 100644 --- a/net/vmnet_int.h +++ b/net/vmnet_int.h @@ -10,7 +10,6 @@ #ifndef VMNET_INT_H #define VMNET_INT_H -#include "qemu/osdep.h" #include "vmnet_int.h" #include "clients.h" diff --git a/qga/cutils.h b/qga/cutils.h index f0f30a7d28..c1f2f4b17a 100644 --- a/qga/cutils.h +++ b/qga/cutils.h @@ -1,8 +1,6 @@ #ifndef CUTILS_H_ #define CUTILS_H_ -#include "qemu/osdep.h" - int qga_open_cloexec(const char *name, int flags, mode_t mode); #endif /* CUTILS_H_ */ diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc index f500e93447..ecf12961cf 100644 --- a/target/cris/translate_v10.c.inc +++ b/target/cris/translate_v10.c.inc @@ -18,7 +18,6 @@ * License along with this library; if not, see . */ -#include "qemu/osdep.h" #include "crisv10-decode.h" static const char * const regnames_v10[] = diff --git a/target/hexagon/hex_arch_types.h b/target/hexagon/hex_arch_types.h index 885f68f760..52a7f2b2f3 100644 --- a/target/hexagon/hex_arch_types.h +++ b/target/hexagon/hex_arch_types.h @@ -18,7 +18,6 @@ #ifndef HEXAGON_HEX_ARCH_TYPES_H #define HEXAGON_HEX_ARCH_TYPES_H -#include "qemu/osdep.h" #include "mmvec/mmvec.h" #include "qemu/int128.h" diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h index 8345753580..6a463a7db3 100644 --- a/target/hexagon/mmvec/macros.h +++ b/target/hexagon/mmvec/macros.h @@ -18,7 +18,6 @@ #ifndef HEXAGON_MMVEC_MACROS_H #define HEXAGON_MMVEC_MACROS_H -#include "qemu/osdep.h" #include "qemu/host-utils.h" #include "arch.h" #include "mmvec/system_ext_mmvec.h" diff --git a/target/riscv/pmu.h b/target/riscv/pmu.h index 58a5bc3a40..4758158e8c 100644 --- a/target/riscv/pmu.h +++ b/target/riscv/pmu.h @@ -16,7 +16,6 @@ * this program. If not, see . */ -#include "qemu/osdep.h" #include "qemu/log.h" #include "cpu.h" #include "qemu/main-loop.h" diff --git a/target/xtensa/core-dc232b/xtensa-modules.c.inc b/target/xtensa/core-dc232b/xtensa-modules.c.inc index 164df3b1a4..31222023d0 100644 --- a/target/xtensa/core-dc232b/xtensa-modules.c.inc +++ b/target/xtensa/core-dc232b/xtensa-modules.c.inc @@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "qemu/osdep.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" diff --git a/target/xtensa/core-dc233c/xtensa-modules.c.inc b/target/xtensa/core-dc233c/xtensa-modules.c.inc index 0f32f0804a..23dba3f4fc 100644 --- a/target/xtensa/core-dc233c/xtensa-modules.c.inc +++ b/target/xtensa/core-dc233c/xtensa-modules.c.inc @@ -21,7 +21,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "qemu/osdep.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" diff --git a/target/xtensa/core-de212/xtensa-modules.c.inc b/target/xtensa/core-de212/xtensa-modules.c.inc index 480c68d3c6..c151f71363 100644 --- a/target/xtensa/core-de212/xtensa-modules.c.inc +++ b/target/xtensa/core-de212/xtensa-modules.c.inc @@ -21,7 +21,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "qemu/osdep.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" diff --git a/target/xtensa/core-fsf/xtensa-modules.c.inc b/target/xtensa/core-fsf/xtensa-modules.c.inc index c32683ff77..c7730de786 100644 --- a/target/xtensa/core-fsf/xtensa-modules.c.inc +++ b/target/xtensa/core-fsf/xtensa-modules.c.inc @@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "qemu/osdep.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" diff --git a/target/xtensa/core-sample_controller/xtensa-modules.c.inc b/target/xtensa/core-sample_controller/xtensa-modules.c.inc index 7e87d216bd..aa498e9b70 100644 --- a/target/xtensa/core-sample_controller/xtensa-modules.c.inc +++ b/target/xtensa/core-sample_controller/xtensa-modules.c.inc @@ -21,7 +21,6 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "qemu/osdep.h" #include "xtensa-isa.h" #include "xtensa-isa-internal.h" diff --git a/ui/vnc-enc-zrle.c.inc b/ui/vnc-enc-zrle.c.inc index b7484aef00..3462329142 100644 --- a/ui/vnc-enc-zrle.c.inc +++ b/ui/vnc-enc-zrle.c.inc @@ -21,9 +21,6 @@ * algorithm writes to the position one past the end of the pixel data. */ - -#include "qemu/osdep.h" - #undef ZRLE_ENDIAN_SUFFIX #if ZYWRLE_ENDIAN == ENDIAN_LITTLE diff --git a/ui/vnc-enc-zywrle-template.c.inc b/ui/vnc-enc-zywrle-template.c.inc index e9be55966e..e3b2e979d8 100644 --- a/ui/vnc-enc-zywrle-template.c.inc +++ b/ui/vnc-enc-zywrle-template.c.inc @@ -100,7 +100,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #define ZYWRLE_QUANTIZE -#include "qemu/osdep.h" #include "vnc-enc-zywrle.h" #ifndef ZRLE_COMPACT_PIXEL From patchwork Thu Jul 7 16:37:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1653701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KKq4wcdX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lf2Ld5r66z9s07 for ; Fri, 8 Jul 2022 02:44:25 +1000 (AEST) Received: from localhost ([::1]:49422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9Uc3-0005li-KR for incoming@patchwork.ozlabs.org; Thu, 07 Jul 2022 12:44:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVy-0008Su-DJ for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UVr-0006pc-VP for qemu-devel@nongnu.org; Thu, 07 Jul 2022 12:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657211878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YpO3X2dhWNMDcL2RL5PGtLi0467hFdMwo9K3xsRLDsY=; b=KKq4wcdXs34+zUbFMQibXlXXmcn5DpiJiv5lppvVFIWK0M+VBfrlUbVXJQiaZzFSEKZt4h IWUwCVizAERuatdMi/LkBLpLfK33ICKD8vGJw9hrjGZjZL4Z6mEFRGy3Z289DI+1FVddrL zQqq2aXZ/QnSZzfmNhOFvk9evR/+KVc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-cV5p6PgdPICvyQhtJgEryQ-1; Thu, 07 Jul 2022 12:37:55 -0400 X-MC-Unique: cV5p6PgdPICvyQhtJgEryQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 795D4833A0D; Thu, 7 Jul 2022 16:37:38 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F9EF40315C; Thu, 7 Jul 2022 16:37:37 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Peter Maydell , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 9/9] tests/style: check qemu/osdep.h is NOT included in all .h/.c.inc files Date: Thu, 7 Jul 2022 17:37:20 +0100 Message-Id: <20220707163720.1421716-10-berrange@redhat.com> In-Reply-To: <20220707163720.1421716-1-berrange@redhat.com> References: <20220707163720.1421716-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since the qemu/osdep.h file must be included as the very first header in all C source files, there is no reason to include it in .h or .c.in files. Signed-off-by: Daniel P. Berrangé --- tests/style.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/style.yml b/tests/style.yml index 6d91ac6115..d2a0299a33 100644 --- a/tests/style.yml +++ b/tests/style.yml @@ -143,3 +143,8 @@ osdep_h_in_source: - tests/uefi-test-tools/.* - tests/unit/test-rcu-(simpleq|slist|tailq)\.c - tools/ebpf/rss.bpf.c + +osdep_h_in_header: + files: \.(h|c\.inc)$ + prohibit: '#include "qemu/osdep\.h"' + message: only C source files may include qemu/osdep.h