|
| From: | Richard Henderson |
| Subject: | Re: [PATCH v1 4/8] target/riscv: Remove the hardcoded MSTATUS_SD macro |
| Date: | Thu, 8 Apr 2021 11:51:52 -0700 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
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~
| [Prev in Thread] | Current Thread | [Next in Thread] |