Re: [RFC PATCH 1/7] compiler_attributes.h: add __attribute__((format_arg)) shorthand

From: Miguel Ojeda
Date: Sat Oct 27 2018 - 08:06:30 EST


Hi Rasmus,

On Sat, Oct 27, 2018 at 1:24 AM Rasmus Villemoes
<linux@xxxxxxxxxxxxxxxxxx> wrote:
>
> diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
> index 6b28c1b7310c..08264df52322 100644
> --- a/include/linux/compiler_attributes.h
> +++ b/include/linux/compiler_attributes.h
> @@ -32,6 +32,7 @@
> # define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9)
> # define __GCC4_has_attribute___designated_init__ 0
> # define __GCC4_has_attribute___externally_visible__ 1
> +# define __GCC4_has_attribute___format_arg__ 1

Thank you Rasmus for doing this already on top of this tree!

> # define __GCC4_has_attribute___noclone__ 1
> # define __GCC4_has_attribute___optimize__ 1
> # define __GCC4_has_attribute___nonstring__ 0
> @@ -140,6 +141,18 @@
> #define __printf(a, b) __attribute__((__format__(printf, a, b)))
> #define __scanf(a, b) __attribute__((__format__(scanf, a, b)))
>
> +/*
> + * Optional

I did quick check and gcc >= 4.1, clang >= 3.0, icc >= 13 compilers
seem to support it (or at least recognize it, even if they just ignore
it), so we do not need to make it optional, no? Did I miss some case?

Thanks!

Cheers,
Miguel