On 28 September 2018 at 13:04, Philippe Mathieu-Daudé <phi...@redhat.com> wrote:
> Hi Peter,
>
> On 27/09/2018 15:48, Peter Maydell wrote:
>> Taking the address of a field in a packed struct is a bad idea, because
>> it might not be actually aligned enough for that pointer type (and
>> thus cause a crash on dereference on some host architectures). Newer
>> versions of clang warn about this. Avoid the bug by not using the
>> "modify in place" byte swapping functions.
>
> The goal of this cleanup is to eventually get rid of the X_to_cpus() and
> cpu_to_Xs()? Or uniquely when the field belong to a packed struct?

The goal of the cleanup is to fix the warnings. I suspect when
we've finished doing that we'll find there are very few
uses of the in-place conversion functions remaining, so maybe
we'll want to get rid of the rest just to reduce the number
of byte-swapping APIs we'll have -- but that's something we
can think about when we get there.

thanks
-- PMM

Reply via email to