This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: stdcall function suffix and -mrtd on Win32
- From: Christopher Faylor <me at cgf dot cx>
- To: Filip Navara <navaraf at reactos dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Apr 2005 20:31:42 -0400
- Subject: Re: stdcall function suffix and -mrtd on Win32
- References: <426D0895.3060507@reactos.com>
On Mon, Apr 25, 2005 at 05:11:17PM +0200, Filip Navara wrote:
>2005-04-25 Filip Navara <navaraf@reactos.com>
>
> * config/i386/winnt.c (i386_pe_encode_section_info):
> Add stdcall suffix to functions that are implicitly declared
> as stdcall when -mrtd option is used.
>
>--- config/i386/winnt.c Thu Dec 30 22:38:22 2004
>+++ config/i386/winnt.c Mon Apr 25 16:19:36 2005
>@@ -393,7 +393,9 @@ i386_pe_encode_section_info (tree decl,
> tree type_attributes = TYPE_ATTRIBUTES (TREE_TYPE (decl));
> tree newid = NULL_TREE;
>
>- if (lookup_attribute ("stdcall", type_attributes))
>+ if (!lookup_attribute ("cdecl", type_attributes) && TARGET_RTD)
>+ newid = gen_stdcall_or_fastcall_suffix (decl, false);
>+ else if (lookup_attribute ("stdcall", type_attributes))
> newid = gen_stdcall_or_fastcall_suffix (decl, false);
> else if (lookup_attribute ("fastcall", type_attributes))
> newid = gen_stdcall_or_fastcall_suffix (decl, true);
Maybe it's just a personal preference (and a very minor point) but I
would prefer just having one if clause to catch the case of a stdcall,
i.e.,
if (lookup_attribute ("stdcall", type_attributes)
|| (!lookup_attribute ("cdecl", type_attributes) && TARGET_RTD))
newid = gen_stdcall_or_fastcall_suffix (decl, false);
You can check that into the trunk, if you want.
cgf