[Bug c/86407] Ignore function attributes in function type declarations?

2019-05-15 Thread alexhenrie24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

--- Comment #6 from Alex Henrie  ---
Created attachment 46363
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46363=edit
[PATCH] Add option to ignore fndecl attributes on function pointers

This patch separates warnings about applying function definition attributes to
function pointers into a separate -Wstrict-function-attributes option. It's the
ideal solution for Wine and it fits well with GCC's existing design. Any
comments before I send it to the mailing list?

[Bug c/86407] Ignore function attributes in function type declarations?

2019-05-03 Thread alexhenrie24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

--- Comment #5 from Alex Henrie  ---
The fundamental problem here is that some people want to combine calling
convention attributes and certain other attributes in a macro and then use that
macro everywhere, whereas other people want to place each attribute only where
it technically belongs. To make both groups happy, we need more granular
warning options.

One possible solution is to add -Wattribute= and -Wno-attribute= switches for
enabling and disabling warnings about specific attributes. For example, Wine
could set `-Wno-attribute=ms_hook_prologue` to get warnings about all
attributes except the __ms_hook_prologue__ attribute and then include that
attribute in the WINAPI macro. Being able to disable warnings about particular
attributes might also be useful if someone wants to change the calling
convention of all functions that return a particular type. In that case it
might be helpful to have a macro like "#define INT64 long long
__attribute__((__cdecl__))", use it to declare both functions and variables,
and then ignore warnings about __cdecl__ being in more places than it needs to
be.

Another possible solution is to split off warnings about function attributes
being used on function pointers (presumably in addition to the function
definitions) into a new option such as -Wstrict-function-attributes to let
people turn off just that warning specifically.

Either way, __force_align_arg_pointer__ should be changed from a type attribute
to a function attribute, and the syntax for suppressing warnings should be the
same or similar for both __ms_hook_prologue__ and __force_align_arg_pointer__.

[Bug c/86407] Ignore function attributes in function type declarations?

2018-07-10 Thread zfigura at codeweavers dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

--- Comment #4 from Zebediah Figura  ---
So is there any sensible way to make this attribute a type attribute instead of
a function attribute? Or is this not desirable?

[Bug c/86407] Ignore function attributes in function type declarations?

2018-07-05 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor  ---
The warning could be suppressed by pragma diagnostic around the typedef like
so:

  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wattributes"
  typedef DWORD (WINAPI *APPLICATION_RECOVERY_CALLBACK)(PVOID);
  #pragma GCC diagnostic pop

Unfortunately, it doesn't look like it's possible to include the pragmas (in
the form of _Pragma("GCC diagnostic pop")) as part of the typedef itself and
have them have the same effect.

[Bug c/86407] Ignore function attributes in function type declarations?

2018-07-05 Thread zfigura at codeweavers dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

--- Comment #2 from Zebediah Figura  ---
(In reply to Richard Biener from comment #1)
> Not possible without creating a sub-option for the warning I guess.  But if
> the attribute is a semantic one then it should be a type attribute rather
> than a decl one.

It doesn't affect the caller at all (although, then again, neither does
__force_align_arg_pointer__).

[Bug c/86407] Ignore function attributes in function type declarations?

2018-07-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86407

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
 Target||x86_64-*-*, i?86-*-*

--- Comment #1 from Richard Biener  ---
Not possible without creating a sub-option for the warning I guess.  But if the
attribute is a semantic one then it should be a type attribute rather than a
decl one.