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

From: Rasmus Villemoes
Date: Mon Oct 29 2018 - 06:20:26 EST

On 2018-10-27 14:06, Miguel Ojeda wrote:
> Hi Rasmus,
> On Sat, Oct 27, 2018 at 1:24 AM Rasmus Villemoes
> <linux@xxxxxxxxxxxxxxxxxx> wrote:
>> +/*
>> + * 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?

No idea. I think I didn't really know what was meant by
required/optional. E.g. something like __aligned must be supported and
honoured for correctness, while format_arg is just about getting some
diagnostics, and assume_aligned just allows for certain optimizations,
so it doesn't really matter whether every single compiler understands
them. It does seem that both icc and clang understand format_arg and
issues warnings when the template doesn't match the varargs, so in that
sense we can make it "required", though it seems a little backwards to
define required in terms of what the current range of compilers support.