[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] linux-user's __get_user/__put_user macros vs clang-7 -W
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] linux-user's __get_user/__put_user macros vs clang-7 -Waddress-of-packed-member |
Date: |
Thu, 27 Sep 2018 18:18:41 +0100 |
On 27 September 2018 at 18:02, Peter Maydell <address@hidden> wrote:
> clang 7 complains about taking the address of a member of a
> packed struct, which is good because those are usually bugs.
> Unfortunately it also means it complains a lot if you pass
> &packed_struct->field to __get_user or __put_user, even
> though in fact those macros are totally safe, since their
> entire purpose is to deal with the data via a load/store
> function that can handle an unaligned address:
> The problem here is that clang complains about
> sizeof(*&p->member) and typeof(*&p->member).
> Arguably this is a compiler bug, but does anybody
> have a suggestion for working around it ?
One idea that occurred to me was to have the definitions
of __get_user() and __put_user() be sprinkled with suitable
invocations of _Pragma("GCC diagnostic ...") to suppress this
warning.
thanks
-- PMM