[PATCH] PR c/86407 - Add option to ignore fndecl attributes on function pointers

Richard Biener rguenther@suse.de
Sat May 25 06:34:00 GMT 2019


On May 24, 2019 5:49:38 PM GMT+02:00, Alex Henrie <alexhenrie24@gmail.com> wrote:
>On Fri, May 24, 2019 at 2:01 AM Richard Biener <rguenther@suse.de>
>wrote:
>>
>> I'm not sure we really need a new warning for this.
>
>On Fri, May 24, 2019 at 9:23 AM Martin Sebor <msebor@gmail.com> wrote:
>>
>> I don't think GCC makes a formal distinction between function
>> attributes that affect only function definitions vs those that
>> affect its users, or both.  It might be a useful distinction
>> to introduce, perhaps even for functions as well as variables,
>> but as it is, users (as well as GCC developers) are on our own
>> to figure it out.
>
>Then is it preferable to simply silence Wattributes in this case?
>
>On Fri, May 24, 2019 at 2:01 AM Richard Biener <rguenther@suse.de>
>wrote:
>>
>> > +int __attribute__((__ms_hook_prologue__)) func(); /* no warnings
>*/
>> > +
>>
>> But this is a declaration?
>
>On Fri, May 24, 2019 at 9:23 AM Martin Sebor <msebor@gmail.com> wrote:
>>
>> My first question is: what is the meaning of "function definition
>> attributes?"  Presumably those that affect only the definition of
>> a function and not its callers or other users?
>
>As far as I can tell, "fndecl" is a misnomer: these attributes are
>more accurately called "function definition attributes", i.e.
>attributes that affect the assembly code of the function but do not
>affect its calling convention.

Yes. The others are attributes also applicable to function types to properly support attributed indirect calls. 

>On Fri, May 24, 2019 at 9:23 AM Martin Sebor <msebor@gmail.com> wrote:
>>
>> Finally, with this as a prerequisite, if we decided that a warning
>> like this would be useful, tests to verify that it works for all
>> the definition attributes and not for the rest would need to be
>> added (i.e., in addition to ms_hook_prologue).
>
>Okay, I will add tests for the other function attributes that should
>behave in the same way, commenting out the tests that will require
>more work to pass.
>
>The end goal is to include __ms_hook_prologue__ in the WINAPI macro on
>Wine without causing spurious warnings. This will go a long way
>towards making Wine compatible with current and future Windows
>programs. Thank you for help.
>
>-Alex



More information about the Gcc-patches mailing list