On 4/8/21 8:20 AM, Alistair Francis wrote:
target_ulong sd = is_32bit(ctx) ? MSTATUS32_SD : MSTATUS64_SD;
It turns out clang doesn't like this, so I might still be stuck with ifdefs.
I think we need
#ifdef TARGET_RISCV32
#define is_32bit(ctx) true
#else
...
#endif
based on
$ cat z.c
int foo(int x) { return x ? 1 : 1ul << 32; }
int bar(void) { return 1 ? 1 : 1ul << 32; }
rth@cloudburst:~$ clang-11 -S -Wall z.c
z.c:1:37: warning: implicit conversion from 'unsigned long' to 'int' changes
value from 4294967296 to 0 [-Wconstant-conversion]
int foo(int x) { return x ? 1 : 1ul << 32; }
~~~~~~ ~~~~^~~~~
r~