qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 4/4] hw/cpu: Call object_class_dynamic_cast() once in cpu_class_by_name()
Date: Sat, 9 Sep 2023 16:26:18 -0700	[thread overview]
Message-ID: <f31f8276-a66a-919e-4f96-9c5fbabe6bc0@linaro.org> (raw)
In-Reply-To: <20230908112235.75914-5-philmd@linaro.org>

On 9/8/23 04:22, Philippe Mathieu-Daudé wrote:
> +++ b/hw/core/cpu-common.c
> @@ -157,7 +157,8 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
>       cc = CPU_CLASS(oc);
>       assert(cc->cpu_resolving_type && cc->class_by_name);
>       oc = cc->class_by_name(cpu_model);
> -    if (oc == NULL || object_class_is_abstract(oc)) {
> +    if (oc == NULL || object_class_is_abstract(oc)
> +                   || !object_class_dynamic_cast(oc, cc->cpu_resolving_type)) {
>           return NULL;
>       }

cc->cpu_resolving_type, as constructed in patch 3, is always @typename.
In the only (!) caller in toplevel/cpu.c, this is CPU_RESOLVING_TYPE.

Indentation:

     if (oc == NULL
         || object_class_is_abstract(oc)
         || !object_class_dynamic_cast(oc, typename)


r~


  reply	other threads:[~2023-09-09 23:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 11:22 [PATCH 0/4] hw/core/cpu-common: Consolidate cpu_class_by_name() Philippe Mathieu-Daudé
2023-09-08 11:22 ` [PATCH 1/4] target/alpha: Tidy up alpha_cpu_class_by_name() Philippe Mathieu-Daudé
2023-09-09 22:17   ` Richard Henderson
2023-09-10 23:29   ` Gavin Shan
2023-09-08 11:22 ` [PATCH 2/4] hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() Philippe Mathieu-Daudé
2023-09-09 22:18   ` Richard Henderson
2023-09-08 11:22 ` [PATCH 3/4] hw/cpu: Introduce CPUClass::cpu_resolving_type field Philippe Mathieu-Daudé
2023-09-09 22:21   ` Richard Henderson
2023-09-10 23:28   ` Gavin Shan
2023-09-11  9:43     ` Philippe Mathieu-Daudé
2023-09-11 10:55       ` Igor Mammedov
2023-09-11 22:40       ` Gavin Shan
2023-09-25  0:24         ` Gavin Shan
2023-10-11  3:28           ` Philippe Mathieu-Daudé
2023-10-11  6:45             ` Gavin Shan
2023-09-08 11:22 ` [PATCH 4/4] hw/cpu: Call object_class_dynamic_cast() once in cpu_class_by_name() Philippe Mathieu-Daudé
2023-09-09 23:26   ` Richard Henderson [this message]
2023-09-10 23:40   ` Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f31f8276-a66a-919e-4f96-9c5fbabe6bc0@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).