with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
-with Opt;
+with Opt; use Opt;
with Output; use Output;
with Sem_Eval; use Sem_Eval;
with Sem_Util; use Sem_Util;
Has_Suffix : Boolean;
begin
+ -- If not generating code, there is no need to create encoded
+ -- names, and problems when the back-end is called to annotate
+ -- types without full code generation. See comments at beginning
+ -- of Get_External_Name_With_Suffix for additional details.
+
+ if Operating_Mode /= Generate_Code then
+ return;
+ end if;
+
Get_Name_String (Chars (E));
-- Nothing to do if we do not have a type
Suffix : String)
is
Has_Suffix : constant Boolean := (Suffix /= "");
- use type Opt.Operating_Mode_Type;
begin
- if Opt.Operating_Mode /= Opt.Generate_Code then
+ -- If we are not in code generation mode, this procedure may still be
+ -- called from Back_End (more specifically - from gigi for doing type
+ -- representation annotation or some representation-specific checks).
+ -- But in this mode there is no need to mess with external names.
- -- If we are not in code generation mode, we still may call this
- -- procedure from Back_End (more specifically - from gigi for doing
- -- type representation annotation or some representation-specific
- -- checks). But in this mode there is no need to mess with external
- -- names. Furthermore, the call causes difficulties in this case
- -- because the string representing the homonym number is not
- -- correctly reset as a part of the call to
- -- Output_Homonym_Numbers_Suffix (which is not called in gigi)
+ -- Furthermore, the call causes difficulties in this case because the
+ -- string representing the homonym number is not correctly reset as a
+ -- part of the call to Output_Homonym_Numbers_Suffix (which is not
+ -- called in gigi).
+ if Operating_Mode /= Generate_Code then
return;
end if;
if Has_Suffix then
Add_Str_To_Name_Buffer ("___");
Add_Str_To_Name_Buffer (Suffix);
-
Name_Buffer (Name_Len + 1) := ASCII.Nul;
end if;
end Get_External_Name_With_Suffix;
procedure Choice_Val (Typ : Character; Choice : Node_Id) is
begin
- Add_Char_To_Name_Buffer (Typ);
-
if Nkind (Choice) = N_Integer_Literal then
+ Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Intval (Choice));
-- Character literal with no entity present (this is the case
elsif Nkind (Choice) = N_Character_Literal
and then No (Entity (Choice))
then
+ Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Char_Literal_Value (Choice));
else
begin
if Ekind (Ent) = E_Enumeration_Literal then
+ Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Enumeration_Rep (Ent));
else
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- or is defined within an overloaded subprogram.
-- - the string "___" followed by Suffix
--
- -- If this procedure is called in the ASIS mode, it does nothing. See the
- -- comments in the body for more details.
+ -- Note that a call to this procedure has no effect if we are not
+ -- generating code, since the necessary information for computing the
+ -- proper encoded name is not available in this case.
--------------------------------------------
-- Subprograms for Handling Qualification --
-------------------------------------------------
procedure Get_Encoded_Name (E : Entity_Id);
- -- If the entity is a typename, store the external name of
- -- the entity as in Get_External_Name, followed by three underscores
- -- plus the type encoding in Name_Buffer with the length in Name_Len,
- -- and an ASCII.NUL character stored following the name.
- -- Otherwise set Name_Buffer and Name_Len to hold the entity name.
+ -- If the entity is a typename, store the external name of the entity as in
+ -- Get_External_Name, followed by three underscores plus the type encoding
+ -- in Name_Buffer with the length in Name_Len, and an ASCII.NUL character
+ -- stored following the name. Otherwise set Name_Buffer and Name_Len to
+ -- hold the entity name. Note that a call to this procedure has no effect
+ -- if we are not generating code, since the necessary information for
+ -- computing the proper encoded name is not available in this case.
--------------
-- Renaming --