From c835c9faa33909024e343fab0ec93b4ba9c8d06b Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Wed, 16 Aug 2023 01:17:19 -0500 Subject: [PATCH] arch-x86,cpu-kvm: Fix gem5.fast due to unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detected via this failing workload: https://github.com/gem5/gem5/actions/runs/5861958237 It caused the following compilation error to be thrown: ``` src/arch/x86/kvm/x86_cpu.cc:1462:22: error: unused variable ‘rv’ [-Werror=unused-variable] 1462 | bool rv = isa->cpuid->doCpuid(tc, function, idx, cpuid); | ^~ ``` `rv` is unused in the .fast compilation as it's only used in the `assert` statement immediately after. To fix this, the `[[maybe_unused]]` annotation is used Change-Id: Ib98dd859c62f171c8eeefae93502f92a8f133776 --- src/arch/x86/kvm/x86_cpu.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/arch/x86/kvm/x86_cpu.cc b/src/arch/x86/kvm/x86_cpu.cc index e1c1b0dfc0..b88a96a2b9 100644 --- a/src/arch/x86/kvm/x86_cpu.cc +++ b/src/arch/x86/kvm/x86_cpu.cc @@ -1459,7 +1459,8 @@ X86KvmCPU::updateCPUID() m5_supported.push_back(makeKvmCpuid(function, idx, cpuid)); } else { while (true) { - bool rv = isa->cpuid->doCpuid(tc, function, idx, cpuid); + [[maybe_unused]] bool rv = isa->cpuid->doCpuid( + tc, function, idx, cpuid); assert(rv); if (idx && @@ -1493,7 +1494,8 @@ X86KvmCPU::updateCPUID() m5_supported.push_back(makeKvmCpuid(function, idx, cpuid)); } else { while (true) { - bool rv = isa->cpuid->doCpuid(tc, function, idx, cpuid); + [[maybe_unused]] bool rv = isa->cpuid->doCpuid( + tc, function, idx, cpuid); assert(rv); if (idx &&