|
From: | Richard Henderson |
Subject: | Re: [PATCH 1/2] target/riscv: Register vendors CSR |
Date: | Wed, 31 Jan 2024 15:06:44 +1000 |
User-agent: | Mozilla Thunderbird |
On 1/30/24 21:11, LIU Zhiwei wrote:
+/* This stub just works for making vendors array not empty */ +riscv_csr_operations stub_csr_ops[CSR_TABLE_SIZE]; +static inline bool never_p(const RISCVCPUConfig *cfg) +{ + return false; +} + +void riscv_tcg_cpu_register_vendor_csr(RISCVCPU *cpu) +{ + static const struct { + bool (*guard_func)(const RISCVCPUConfig *); + riscv_csr_operations *csr_ops; + } vendors[] = { + { never_p, stub_csr_ops }, + }; + for (size_t i = 0; i < ARRAY_SIZE(vendors); ++i) {
Presumably you did this to avoid a Werror for "i < 0", since i is unsigned. It would be better to either use "int i", or for (size_t i = 0, n = ARRAY_SIZE(vendors); i < n; ++i) either of which will not Werror. Especially considering the size of stub_csr_ops. r~
[Prev in Thread] | Current Thread | [Next in Thread] |