[Patch]"Sema::checkFormatStringExpr" should check multiple "FormatAttr".

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Sep 24 13:55:06 PDT 2013


On 24 September 2013 16:48, Fuyao Zhao <fuyaoz at google.com> wrote:
> I can't find any thing about re declare function twice with different
> arguments in the standard. So I think it's a non defined behavior.
> Currently, what clang does is always pick the latest attribute it sees.
>
> my change is to fix the case that one function has multiple format_arg
> attribute
>
> and your suggestion is essentially about check the behavior when people
> define a function with different attribute (it doesn't have to be
> format_arg, it could be any of the attributes)
>
> Unless you could confirm current clang behavior is desired (always use the
> latest declaration), I don't think it's good to write a test case for
> non-defined behavior. Even we really want to do it, I want to do it in a
> separate patch because people then could revert it separately.

For attributes that are gcc extensions, we normally just follow gcc
unless there is a good reason to be different. I agree that if we
already do the same thing gcc does it would be best to add a test for
it first. That way it is clear your patch is not changing that
behavior.

Cheers,
Rafael



More information about the cfe-commits mailing list