qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] bswap: Add new stn_*_p() and ldn_*_p() memo


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1/3] bswap: Add new stn_*_p() and ldn_*_p() memory access functions
Date: Mon, 11 Jun 2018 18:51:55 +0100

On 11 June 2018 at 18:43, Philippe Mathieu-Daudé <address@hidden> wrote:
> Hi Peter,
>
> On 06/11/2018 02:10 PM, Peter Maydell wrote:
>> +/* Store v to p as a sz byte value in host order */
>> +#define DO_STN_LDN_P(END) \
>> +    static inline void stn_## END ## _p(void *ptr, int sz, uint64_t v)  \
>> +    {                                                                   \
>> +        switch (sz) {                                                   \
>> +        case 1:                                                         \
>> +            stb_p(ptr, v);                                              \
>> +            break;                                                      \
>> +        case 2:                                                         \
>> +            stw_ ## END ## _p(ptr, v);                                  \
>> +            break;                                                      \
>> +        case 4:                                                         \
>> +            stl_ ## END ## _p(ptr, v);                                  \
>> +            break;                                                      \
>> +        case 8:                                                         \
>> +            stq_ ## END ## _p(ptr, v);                                  \
>> +            break;                                                      \
>> +        default:                                                        \
>> +            g_assert_not_reached();                                     \
>
> As with the recent discussion with Markus about whether using abort() or
> g_assert_not_reached(), I'd prefer to keep abort() here (which is what
> exec.c currently uses).
>
> [http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg01869.html]

I couldn't find anything obvious about the merits of abort() vs
g_assert_not_reached() in that email. g_assert_not_reached() is clear
about what it's doing and we use it in hundreds of places in the
codebase, whereas abort() is used for various things, including
situations where flow-of-execution clearly can get to that location.
So I prefer g_assert_not_reached().

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]