summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-28 14:58:28 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-28 14:58:28 +0000
commitf92da23472e7512242de1254c86d2f3ffd26c320 (patch)
tree070c0a9f1408dc8f96b33e0f56b694a77fc5232e /gcc/ada/gcc-interface/decl.c
parent2bdae24115fe3601b44597bcd61f1004d6838024 (diff)
downloadgcc-f92da23472e7512242de1254c86d2f3ffd26c320.tar.gz
* exp_dbug.ads (Get_External_Name): Add 'False' default to Has_Suffix,
add 'Suffix' parameter and adjust comment. (Get_External_Name_With_Suffix): Delete. * exp_dbug.adb (Get_External_Name_With_Suffix): Merge into... (Get_External_Name): ...here. Add 'False' default to Has_Suffix, add 'Suffix' parameter. (Get_Encoded_Name): Remove 2nd argument in call to Get_External_Name. Call Get_External_Name instead of Get_External_Name_With_Suffix. (Get_Secondary_DT_External_Name): Likewise. * exp_cg.adb (Write_Call_Info): Likewise. * exp_disp.adb (Export_DT): Likewise. (Import_DT): Likewise. * comperr.ads (Compiler_Abort): Remove Code parameter and add From_GCC parameter with False default. * comperr.adb (Compiler_Abort): Likewise. Adjust accordingly. * types.h (Fat_Pointer): Rename into... (String_Pointer): ...this. Add comment on interfacing rules. * fe.h (Compiler_Abort): Adjust for above renaming. (Error_Msg_N): Likewise. (Error_Msg_NE): Likewise. (Get_External_Name): Likewise. Add third parameter. (Get_External_Name_With_Suffix): Delete. * gcc-interface/decl.c (STDCALL_PREFIX): Define. (create_concat_name): Adjust call to Get_External_Name, remove call to Get_External_Name_With_Suffix, use STDCALL_PREFIX, adjust for renaming. * gcc-interface/trans.c (post_error): Likewise. (post_error_ne): Likewise. * gcc-interface/misc.c (internal_error_function): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209866 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c20
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);
}