diff options
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 7c3f7e5ea7b..73945f10ec5 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -72,6 +72,8 @@ #define Has_Thiscall_Convention(E) 0 #endif +#define STDCALL_PREFIX "_imp__" + /* Stack realignment is necessary for functions with foreign conventions when the ABI doesn't mandate as much as what the compiler assumes - that is, up to PREFERRED_STACK_BOUNDARY. @@ -8856,16 +8858,12 @@ get_entity_name (Entity_Id gnat_entity) tree create_concat_name (Entity_Id gnat_entity, const char *suffix) { - Entity_Kind kind = Ekind (gnat_entity); + const Entity_Kind kind = Ekind (gnat_entity); + const bool has_suffix = (suffix != NULL); + String_Template temp = {1, has_suffix ? strlen (suffix) : 0}; + String_Pointer sp = {suffix, &temp}; - if (suffix) - { - String_Template temp = {1, (int) strlen (suffix)}; - Fat_Pointer fp = {suffix, &temp}; - Get_External_Name_With_Suffix (gnat_entity, fp); - } - else - Get_External_Name (gnat_entity, 0); + Get_External_Name (gnat_entity, has_suffix, sp); /* A variable using the Stdcall convention lives in a DLL. We adjust its name to use the jump table, the _imp__NAME contains the address @@ -8873,9 +8871,9 @@ create_concat_name (Entity_Id gnat_entity, const char *suffix) if ((kind == E_Variable || kind == E_Constant) && Has_Stdcall_Convention (gnat_entity)) { - const int len = 6 + Name_Len; + const int len = strlen (STDCALL_PREFIX) + Name_Len; char *new_name = (char *) alloca (len + 1); - strcpy (new_name, "_imp__"); + strcpy (new_name, STDCALL_PREFIX); strcat (new_name, Name_Buffer); return get_identifier_with_length (new_name, len); } |