Skip to content

Commit 2ca5dcc

Browse files
committed
Fix Clang error when disabling Zicsr
When using 'make ENABLE_Zicsr=0 CC=clang', the following error is observed: src/emulate.c:83:20: error: unused function 'update_time' [-Werror,-Wunused-function] 83 | static inline void update_time(riscv_t *rv) | ^~~~~~~~~~~ 1 error generated Fix this by guarding the update_time function definition with RV32_HAS(Zicsr) macro. This ensures the function is only defined when the Zicsr is enabled.
1 parent 7384d92 commit 2ca5dcc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/emulate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ static void __trap_handler(riscv_t *rv);
7979
}
8080

8181
/* FIXME: use more precise methods for updating time, e.g., RTC */
82+
#if RV32_HAS(Zicsr)
8283
static uint64_t ctr = 0;
8384
static inline void update_time(riscv_t *rv)
8485
{
8586
rv->csr_time[0] = ctr & 0xFFFFFFFF;
8687
rv->csr_time[1] = ctr >> 32;
8788
}
8889

89-
#if RV32_HAS(Zicsr)
9090
/* get a pointer to a CSR */
9191
static uint32_t *csr_get_ptr(riscv_t *rv, uint32_t csr)
9292
{

0 commit comments

Comments
 (0)