aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-07-15 22:34:43 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-07-15 22:34:43 +0200
commit523456dbde953a6f2dac504b2fd2ff1ddc8ec03d (patch)
tree42274aa36e810d3b5f8091bed03b3cb361cda56e /gcc/ada/sem_prag.adb
parent0c0df4b3f017b53fb9a0760ce8c68c293a573a76 (diff)
downloadgcc-523456dbde953a6f2dac504b2fd2ff1ddc8ec03d.zip
gcc-523456dbde953a6f2dac504b2fd2ff1ddc8ec03d.tar.gz
gcc-523456dbde953a6f2dac504b2fd2ff1ddc8ec03d.tar.bz2
[multiple changes]
2004-07-15 Robert Dewar <dewar@gnat.com> * makegpr.adb, s-secsta.ads, sem_ch3.adb, sem_case.adb: Minor reformatting * gnat_ugn.texi: Add instantiation of direct_io or sequential_io with access values as an example of a warning. * gnat_rm.texi: Document new attribute Has_Access_Values * gnat-style.texi: Document that box comments belong on nested subprograms * sem_util.ads (Has_Access_Values): Improved documentation * s-finimp.ads, s-finimp.adb: Fix spelling error in comment * sem_prag.adb (Check_Duplicated_Export_Name): New procedure (Process_Interface_Name): Call to this new procedure (Set_Extended_Import_Export_External_Name): Call to this new procedure * s-mastop-x86.adb, 9drpc.adb: Fix spelling error in comment * a-direio.ads, a-sequio.ads: Warn if Element_Type has access values * einfo.ads: Minor comment typo fixed 2004-07-15 Jose Ruiz <ruiz@act-europe.fr> * snames.adb: Add _atcb. * snames.ads: Add Name_uATCB. * s-tarest.adb (Create_Restricted_Task): ATCBs are always preallocated (in the expanded code) when using the restricted run time. * s-tarest.ads (Create_Restricted_Task): Created_Task transformed into a in parameter in order to allow ATCBs to be preallocated (in the expanded code). * s-taskin.adb (Initialize_ATCB): T converted into a in parameter in order to allow ATCBs to be preallocated. In case of error, the ATCB is deallocated in System.Tasking.Stages. * s-taskin.ads (Initialize_ATCB): T converted into a in parameter in order to allow ATCBs to be preallocated. * s-tassta.adb (Create_Task): In case of error the ATCB is deallocated here. It was previously done in Initialize_ATCB. * rtsfind.ads: Make the Ada_Task_Control_Block visible. * exp_ch9.adb: Preallocate the Ada_Task_Control_Block when using the Restricted run time. * exp_ch3.adb: When using the Restricted run time, pass the preallocated Ada_Task_Control_Block when creating a task. 2004-07-15 Ed Schonberg <schonberg@gnat.com> * sem_util.adb (Normalize_Actuals): If there are no actuals on a function call that is itself an actual in an enclosing call, diagnose problem here rather than assuming that resolution will catch it. * sem_ch7.adb (Analyze_Package_Specification): If the specification is the local copy of a generic unit for a formal package, and the generic is a child unit, install private part of ancestors before compiling private part of spec. * sem_cat.adb (Validate_Categorization_Dependency): Simplify code to use scope entities rather than tree structures, to handle properly parent units that are instances rewritten as bodies for inlining purposes. * sem_ch10.adb (Get_Parent_Entity, Implicit_With_On_Parent, Remove_Parents): Handle properly a parent unit that is an instantiation, when the unit has been rewritten as a body for inlining purposes. * par.adb (Goto_List): Global variable to collect goto statements in a given unit, for use in detecting natural loops. * par-ch5.adb (P_Goto_Statement): Add goto to global Goto_List, for use in detecting natural loops. * par-labl.adb (Find_Natural_Loops): Recognize loops create by backwards goto's, and rewrite as a infinite loop, to improve locality of temporaries. * exp_util.adb (Force_Evaluation): Recognize a left-hand side subcomponent that includes an indexed reference, to prevent the generation of copies that would miscompile the desired assignment statement. (Build_Task_Image_Decls): Add a numeric suffix to generated name for string variable, to avoid spurious conflicts with the name of the type of a single protected object. * exp_ch4.adb (Expand_Array_Equality): If indices are distinct, use a loop with an explicit exit statement, to avoid generating an out-of-range value with 'Succ leading to spurious constraint_errors when compiling with -gnatVo. 2004-07-15 Thomas Quinot <quinot@act-europe.fr> * sem_ch4.adb (Analyze_Slice): Always call Analyze on the prefix: it might not be analyzed yet, even if its Etype is already set (case of an unchecked conversion built using Unchecked_Convert_To, for example). If the prefix has already been analyzed, this will be a nop anyway. * exp_ch5.adb (Make_Tag_Ctrl_Assignment): For an assignment of a controller type, or an assignment of a record type with controlled components, copy only user data, and leave the finalization chain pointers untouched. 2004-07-15 Vincent Celier <celier@gnat.com> * make.adb (Collect_Arguments): Improve error message when attempting to compile a source not part of any project, when -x is not used. * prj.ads: (Defined_Variable_Kind): New subtype * prj-attr.adb (Register_New_Package): Two new procedures to register a package with or without its attributes. (Register_New_Attribute): Mew procedure to register a new attribute in a package. New attribute oriented subprograms: Attribute_Node_Id_Of, Attribute_Kind_Of, Set_Attribute_Kind_Of, Attribute_Name_Of, Variable_Kind_Of, Set_Variable_Kind_Of, Optional_Index_Of, Next_Attribute. New package oriented subprograms: Package_Node_Id_Of, Add_Unknown_Package, First_Attribute_Of, Add_Attribute. * prj-attr.ads (Attribute_Node_Id): Now a private, self initialized type. (Package_Node_Id): Now a private, self initialized type (Register_New_Package): New procedure to register a package with its attributes. New attribute oriented subprograms: Attribute_Node_Id_Of, Attribute_Kind_Of, Set_Attribute_Kind_Of, Attribute_Name_Of, Variable_Kind_Of, Set_Variable_Kind_Of, Optional_Index_Of, Next_Attribute. New package oriented subprograms: Package_Node_Id_Of, Add_Unknown_Package, First_Attribute_Of, Add_Attribute. * prj-dect.adb (Parse_Attribute_Declaration, Parse_Package_Declaration): Adapt to new spec of Prj.Attr. * prj-makr.adb (Make): Parse existing project file before creating other files. Fail if there was an error during parsing. * prj-proc.adb (Add_Attributes, Process_Declarative_Items): Adapt to new spec of Prj.Attr. * prj-strt.adb (Attribute_Reference, Parse_Variable_Reference): Adapt to new spec of Prj.Attr. 2004-07-15 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * utils2.c: Fix typo in comment. From-SVN: r84774
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb73
1 files changed, 66 insertions, 7 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 0434d67..0ce7209 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -72,6 +72,7 @@ with Sinput; use Sinput;
with Snames; use Snames;
with Stringt; use Stringt;
with Stylesw; use Stylesw;
+with Table;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes;
@@ -138,6 +139,26 @@ package body Sem_Prag is
-- design and implementation and are intended to be fully compatible
-- with the use of these pragmas in the DEC Ada compiler.
+ --------------------------------------------
+ -- Checking for Duplicated External Names --
+ --------------------------------------------
+
+ -- It is suspicious if two separate Export pragmas use the same external
+ -- name. The following table is used to diagnose this situation so that
+ -- an appropriate warning can be issued.
+
+ -- The Node_Id stored is for the N_String_Literal node created to
+ -- hold the value of the external name. The Sloc of this node is
+ -- used to cross-reference the location of the duplication.
+
+ package Externals is new Table.Table (
+ Table_Component_Type => Node_Id,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 0,
+ Table_Initial => 100,
+ Table_Increment => 100,
+ Table_Name => "Name_Externals");
+
-------------------------------------
-- Local Subprograms and Variables --
-------------------------------------
@@ -308,6 +329,12 @@ package body Sem_Prag is
procedure Check_At_Most_N_Arguments (N : Nat);
-- Check there are no more than N arguments present
+ procedure Check_Duplicated_Export_Name (Nam : Node_Id);
+ -- Nam is an N_String_Literal node containing the external name set
+ -- by an Import or Export pragma (or extended Import or Export pragma).
+ -- This procedure checks for possible duplications if this is the
+ -- export case, and if found, issues an appropriate error message.
+
procedure Check_First_Subtype (Arg : Node_Id);
-- Checks that Arg, whose expression is an entity name referencing
-- a subtype, does not reference a type that is not a first subtype.
@@ -896,6 +923,39 @@ package body Sem_Prag is
end if;
end Check_At_Most_N_Arguments;
+ ----------------------------------
+ -- Check_Duplicated_Export_Name --
+ ----------------------------------
+
+ procedure Check_Duplicated_Export_Name (Nam : Node_Id) is
+ String_Val : constant String_Id := Strval (Nam);
+
+ begin
+ -- We are only interested in the export case, and in the case of
+ -- generics, it is the instance, not the template, that is the
+ -- problem (the template will generate a warning in any case).
+
+ if not Inside_A_Generic
+ and then (Prag_Id = Pragma_Export
+ or else
+ Prag_Id = Pragma_Export_Procedure
+ or else
+ Prag_Id = Pragma_Export_Valued_Procedure
+ or else
+ Prag_Id = Pragma_Export_Function)
+ then
+ for J in Externals.First .. Externals.Last loop
+ if String_Equal (String_Val, Strval (Externals.Table (J))) then
+ Error_Msg_Sloc := Sloc (Externals.Table (J));
+ Error_Msg_N ("external name duplicates name given#", Nam);
+ exit;
+ end if;
+ end loop;
+
+ Externals.Append (Nam);
+ end if;
+ end Check_Duplicated_Export_Name;
+
-------------------------
-- Check_First_Subtype --
-------------------------
@@ -3275,9 +3335,7 @@ package body Sem_Prag is
-- If there is no link name, just set the external name
if No (Link_Nam) then
- Set_Encoded_Interface_Name
- (Get_Base_Subprogram (Subprogram_Def),
- Adjust_External_Name_Case (Expr_Value_S (Ext_Nam)));
+ Link_Nam := Adjust_External_Name_Case (Expr_Value_S (Ext_Nam));
-- For the Link_Name case, the given literal is preceded by an
-- asterisk, which indicates to GCC that the given name should
@@ -3296,10 +3354,11 @@ package body Sem_Prag is
Link_Nam :=
Make_String_Literal (Sloc (Link_Nam), End_String);
-
- Set_Encoded_Interface_Name
- (Get_Base_Subprogram (Subprogram_Def), Link_Nam);
end if;
+
+ Set_Encoded_Interface_Name
+ (Get_Base_Subprogram (Subprogram_Def), Link_Nam);
+ Check_Duplicated_Export_Name (Link_Nam);
end Process_Interface_Name;
-----------------------------------------
@@ -3740,8 +3799,8 @@ package body Sem_Prag is
else
Set_Encoded_Interface_Name (Internal_Ent, New_Name);
+ Check_Duplicated_Export_Name (New_Name);
end if;
-
end Set_Extended_Import_Export_External_Name;
------------------