[PATCH 7/9] include: Upgrade <linux/typecheck.h>

Simon Glass sjg at chromium.org
Wed Mar 16 20:23:38 CET 2022


Hi,

On Wed, 16 Mar 2022 at 09:41, Pierre-Clément Tosi <ptosi at google.com> wrote:
>
> Upgrade the header to version 5.16 of the kernel:
>
>     commit df0cc57e057f18e44dac8e6c18aba47ab53202f9
>
> Signed-off-by: Pierre-Clément Tosi <ptosi at google.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  include/linux/typecheck.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>

But I don't understand how this works at all. Could you add a comment?

>
> diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h
> index eb5b74a575..46b15e2aae 100644
> --- a/include/linux/typecheck.h
> +++ b/include/linux/typecheck.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
>  #ifndef TYPECHECK_H_INCLUDED
>  #define TYPECHECK_H_INCLUDED
>
> @@ -21,4 +22,13 @@
>         (void)__tmp; \
>  })
>
> +/*
> + * Check at compile time that something is a pointer type.
> + */
> +#define typecheck_pointer(x) \
> +({     typeof(x) __dummy; \
> +       (void)sizeof(*__dummy); \
> +       1; \
> +})
> +
>  #endif         /* TYPECHECK_H_INCLUDED */
> --
> 2.35.1.723.g4982287a31-goog
>

Regards,
Simon


More information about the U-Boot mailing list