On 27 September 2018 at 18:02, Peter Maydell <peter.mayd...@linaro.org> 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

Reply via email to