Commit 79503fdd by Geert Bosch

* make.adb:

	(Switches_Of): New function
	(Test_If_Relative_Path): New procedure
	(Add_Switches): Use new function Switches_Of
	(Collect_Arguments_And_Compile): Use new function Switches_Of.
	When using a project file, test if there are any relative
	search path. Fail if there are any.
	(Gnatmake): Only add switches for the primary directory when not using
	a project file. When using a project file, change directory to the
	object directory of the main project file. When using a project file,
	test if there are any relative search path. Fail if there are any.
	When using a project file, fail if specified executable is relative
	path with directory information, and prepend executable, if not
	specified as an absolute path, with the exec directory.  Make sure
	that only one -o switch is transmitted to the linker.

	* prj-attr.adb (Initialization_Data): Add project attribute Exec_Dir

	* prj-nmsc.adb:
	(Ada_Check): Get Spec_Suffix_Loc and Impl_Suffix_Loc,
	when using a non standard naming scheme.
	(Check_Ada_Naming_Scheme): Make sure that error messages
	do not raise exceptions.
	(Is_Illegal_Append): Return True if there is no dot in the suffix.
	(Language_Independent_Check): Check the exec directory.

	* prj.adb (Project_Empty): Add new component Exec_Directory

	* prj.ads:
	(Default_Ada_Spec_Suffix, Default_Ada_Impl_Suffix): Add defaults.
	(Project_Data): Add component Exec_Directory

	* snames.adb: Updated to match snames.ads revision 1.215

	* snames.ads: Added Exec_Dir

	* make.adb: Minor reformatting

	* prj-nmsc.adb: Minor reformatting

	* snames.adb: Updated to match snames.ads

	* snames.ads: Alphebetize entries for project file

	* trans.c (process_freeze_entity): Do nothing if the entity is a
	subprogram that was already elaborated.

	* decl.c (gnat_to_gnu_entity, object): Do not back-annotate Alignment
	and Esize if object is referenced via pointer.

From-SVN: r48127
parent 855ff2e1
2001-12-17 Vincent Celier <celier@gnat.com>
* make.adb:
(Switches_Of): New function
(Test_If_Relative_Path): New procedure
(Add_Switches): Use new function Switches_Of
(Collect_Arguments_And_Compile): Use new function Switches_Of.
When using a project file, test if there are any relative
search path. Fail if there are any.
(Gnatmake): Only add switches for the primary directory when not using
a project file. When using a project file, change directory to the
object directory of the main project file. When using a project file,
test if there are any relative search path. Fail if there are any.
When using a project file, fail if specified executable is relative
path with directory information, and prepend executable, if not
specified as an absolute path, with the exec directory. Make sure
that only one -o switch is transmitted to the linker.
* prj-attr.adb (Initialization_Data): Add project attribute Exec_Dir
* prj-nmsc.adb:
(Ada_Check): Get Spec_Suffix_Loc and Impl_Suffix_Loc,
when using a non standard naming scheme.
(Check_Ada_Naming_Scheme): Make sure that error messages
do not raise exceptions.
(Is_Illegal_Append): Return True if there is no dot in the suffix.
(Language_Independent_Check): Check the exec directory.
* prj.adb (Project_Empty): Add new component Exec_Directory
* prj.ads:
(Default_Ada_Spec_Suffix, Default_Ada_Impl_Suffix): Add defaults.
(Project_Data): Add component Exec_Directory
* snames.adb: Updated to match snames.ads revision 1.215
* snames.ads: Added Exec_Dir
2001-12-17 Robert Dewar <dewar@gnat.com>
* make.adb: Minor reformatting
* prj-nmsc.adb: Minor reformatting
* snames.adb: Updated to match snames.ads
* snames.ads: Alphebetize entries for project file
2001-12-17 Ed Schonberg <schonber@gnat.com>
* trans.c (process_freeze_entity): Do nothing if the entity is a
subprogram that was already elaborated.
2001-12-17 Richard Kenner <kenner@gnat.com>
* decl.c (gnat_to_gnu_entity, object): Do not back-annotate Alignment
and Esize if object is referenced via pointer.
2001-12-17 Ed Schonberg <schonber@gnat.com>
* sem_ch3.adb (Analyze_Variant_Part): check that type of discriminant
......
......@@ -1060,12 +1060,15 @@ gnat_to_gnu_entity (gnat_entity, gnu_expr, definition)
}
/* Back-annotate the Alignment of the object if not already in the
tree. Likewise for Esize if the object is of a constant size. */
if (Unknown_Alignment (gnat_entity))
tree. Likewise for Esize if the object is of a constant size.
But if the "object" is actually a pointer to an object, the
alignment and size are the same as teh type, so don't back-annotate
the values for the pointer. */
if (! used_by_ref && Unknown_Alignment (gnat_entity))
Set_Alignment (gnat_entity,
UI_From_Int (DECL_ALIGN (gnu_decl) / BITS_PER_UNIT));
if (Unknown_Esize (gnat_entity)
if (! used_by_ref && Unknown_Esize (gnat_entity)
&& DECL_SIZE (gnu_decl) != 0)
{
tree gnu_back_size = DECL_SIZE (gnu_decl);
......
......@@ -54,6 +54,7 @@ package body Prj.Attr is
-- project attributes
"SVobject_dir#" &
"SVexec_dir#" &
"LVsource_dirs#" &
"LVsource_files#" &
"SVsource_list_file#" &
......
......@@ -628,14 +628,18 @@ package body Prj.Nmsc is
-- Check Specification_Suffix
declare
Ada_Spec_Suffix : constant Name_Id :=
Ada_Spec_Suffix : constant Variable_Value :=
Prj.Util.Value_Of
(Index => Name_Ada,
In_Array => Data.Naming.Specification_Suffix);
begin
if Ada_Spec_Suffix /= No_Name then
Data.Naming.Current_Spec_Suffix := Ada_Spec_Suffix;
if Ada_Spec_Suffix.Kind = Single
and then String_Length (Ada_Spec_Suffix.Value) /= 0
then
String_To_Name_Buffer (Ada_Spec_Suffix.Value);
Data.Naming.Current_Spec_Suffix := Name_Find;
Data.Naming.Spec_Suffix_Loc := Ada_Spec_Suffix.Location;
else
Data.Naming.Current_Spec_Suffix := Default_Ada_Spec_Suffix;
......@@ -652,14 +656,18 @@ package body Prj.Nmsc is
-- Check Implementation_Suffix
declare
Ada_Impl_Suffix : constant Name_Id :=
Ada_Impl_Suffix : constant Variable_Value :=
Prj.Util.Value_Of
(Index => Name_Ada,
In_Array => Data.Naming.Implementation_Suffix);
begin
if Ada_Impl_Suffix /= No_Name then
Data.Naming.Current_Impl_Suffix := Ada_Impl_Suffix;
if Ada_Impl_Suffix.Kind = Single
and then String_Length (Ada_Impl_Suffix.Value) /= 0
then
String_To_Name_Buffer (Ada_Impl_Suffix.Value);
Data.Naming.Current_Impl_Suffix := Name_Find;
Data.Naming.Impl_Suffix_Loc := Ada_Impl_Suffix.Location;
else
Data.Naming.Current_Impl_Suffix := Default_Ada_Impl_Suffix;
......@@ -920,9 +928,9 @@ package body Prj.Nmsc is
end if;
end Check_Ada_Name;
-------------------------
-- Check_Naming_Scheme --
-------------------------
-----------------------------
-- Check_Ada_Naming_Scheme --
-----------------------------
procedure Check_Ada_Naming_Scheme (Naming : Naming_Data) is
begin
......@@ -982,24 +990,24 @@ package body Prj.Nmsc is
-- - start with an '_' followed by an alphanumeric
if Is_Illegal_Append (Specification_Suffix) then
Error_Msg_Name_1 := Naming.Current_Spec_Suffix;
Error_Msg
('"' & Specification_Suffix &
""" is illegal for Specification_Suffix.",
("{ is illegal for Specification_Suffix",
Naming.Spec_Suffix_Loc);
end if;
if Is_Illegal_Append (Implementation_Suffix) then
Error_Msg_Name_1 := Naming.Current_Impl_Suffix;
Error_Msg
('"' & Implementation_Suffix &
""" is illegal for Implementation_Suffix.",
("% is illegal for Implementation_Suffix",
Naming.Impl_Suffix_Loc);
end if;
if Implementation_Suffix /= Separate_Suffix then
if Is_Illegal_Append (Separate_Suffix) then
Error_Msg_Name_1 := Naming.Separate_Suffix;
Error_Msg
('"' & Separate_Suffix &
""" is illegal for Separate_Append.",
("{ is illegal for Separate_Append",
Naming.Sep_Suffix_Loc);
end if;
end if;
......@@ -1039,6 +1047,7 @@ package body Prj.Nmsc is
end if;
end;
end if;
end Check_Ada_Naming_Scheme;
---------------
......@@ -1430,6 +1439,7 @@ package body Prj.Nmsc is
begin
return This'Length = 0
or else Is_Alphanumeric (This (This'First))
or else Index (This, ".") = 0
or else (This'Length >= 2
and then This (This'First) = '_'
and then Is_Alphanumeric (This (This'First + 1)));
......@@ -1701,7 +1711,7 @@ package body Prj.Nmsc is
Write_Line ("Starting to look for directories");
end if;
-- Let's check the object directory
-- Check the object directory
declare
Object_Dir : Variable_Value :=
......@@ -1757,6 +1767,62 @@ package body Prj.Nmsc is
end if;
end if;
-- Check the exec directory
declare
Exec_Dir : Variable_Value :=
Util.Value_Of (Name_Exec_Dir, Data.Decl.Attributes);
begin
pragma Assert (Exec_Dir.Kind = Single,
"Exec_Dir is not a single string");
-- We set the object directory to its default
Data.Exec_Directory := Data.Object_Directory;
if not String_Equal (Exec_Dir.Value, Empty_String) then
String_To_Name_Buffer (Exec_Dir.Value);
if Name_Len = 0 then
Error_Msg ("Exec_Dir cannot be empty",
Exec_Dir.Location);
else
-- We check that the specified object directory
-- does exist.
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
declare
Dir_Id : constant Name_Id := Name_Find;
begin
Data.Exec_Directory :=
Locate_Directory (Dir_Id, Data.Directory);
if Data.Exec_Directory = No_Name then
Error_Msg_Name_1 := Dir_Id;
Error_Msg
("the exec directory { cannot be found",
Data.Location);
end if;
end;
end if;
end if;
end;
if Current_Verbosity = High then
if Data.Exec_Directory = No_Name then
Write_Line ("No exec directory");
else
Write_Str ("Exec directory: """);
Write_Str (Get_Name_String (Data.Exec_Directory));
Write_Line ("""");
end if;
end if;
-- Look for the source directories
declare
......
......@@ -89,6 +89,7 @@ package body Prj is
Sources => Nil_String,
Source_Dirs => Nil_String,
Object_Directory => No_Name,
Exec_Directory => No_Name,
Modifies => No_Project,
Modified_By => No_Project,
Naming => Std_Naming_Data,
......
......@@ -40,11 +40,11 @@ with Types; use Types;
package Prj is
Default_Ada_Spec_Suffix : Name_Id := No_Name;
Default_Ada_Spec_Suffix : Name_Id;
-- The Name_Id for the standard GNAT suffix for Ada spec source file
-- name ".ads". Initialized by Prj.Initialize.
Default_Ada_Impl_Suffix : Name_Id := No_Name;
Default_Ada_Impl_Suffix : Name_Id;
-- The Name_Id for the standard GNAT suffix for Ada body source file
-- name ".adb". Initialized by Prj.Initialize.
......@@ -366,6 +366,11 @@ package Prj is
-- The object directory of this project file.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Exec_Directory : Name_Id := No_Name;
-- The exec directory of this project file.
-- Default is equal to Object_Directory.
-- Set by Prj.Nmsc.Check_Naming_Scheme.
Modifies : Project_Id := No_Project;
-- The reference of the project file, if any, that this
-- project file modifies.
......
......@@ -566,36 +566,37 @@ package body Snames is
"requeue#" &
"tagged#" &
"raise_exception#" &
"project#" &
"binder#" &
"builder#" &
"compiler#" &
"cross_reference#" &
"default_switches#" &
"exec_dir#" &
"extends#" &
"naming#" &
"object_dir#" &
"source_dirs#" &
"specification#" &
"finder#" &
"gnatls#" &
"gnatstub#" &
"implementation#" &
"specification_exceptions#" &
"implementation_exceptions#" &
"specification_suffix#" &
"implementation_suffix#" &
"separate_suffix#" &
"source_files#" &
"source_list_file#" &
"default_switches#" &
"switches#" &
"languages#" &
"library_dir#" &
"library_name#" &
"library_elaboration#" &
"library_kind#" &
"library_name#" &
"library_version#" &
"library_elaboration#" &
"languages#" &
"builder#" &
"gnatls#" &
"cross_reference#" &
"finder#" &
"binder#" &
"linker#" &
"compiler#" &
"gnatstub#" &
"naming#" &
"object_dir#" &
"project#" &
"separate_suffix#" &
"source_dirs#" &
"source_files#" &
"source_list_file#" &
"specification#" &
"specification_exceptions#" &
"specification_suffix#" &
"switches#" &
"#";
---------------------
......
......@@ -861,44 +861,40 @@ package Snames is
-- Additional reserved words in GNAT Project Files
-- Note that Name_External is already previously declared
Name_Project : constant Name_Id := N + 523;
Name_Extends : constant Name_Id := N + 524;
-- Names used in GNAT Project Files
Name_Naming : constant Name_Id := N + 525;
Name_Object_Dir : constant Name_Id := N + 526;
Name_Source_Dirs : constant Name_Id := N + 527;
Name_Specification : constant Name_Id := N + 528;
Name_Implementation : constant Name_Id := N + 529;
Name_Specification_Exceptions : constant Name_Id := N + 530;
Name_Implementation_Exceptions : constant Name_Id := N + 531;
Name_Specification_Suffix : constant Name_Id := N + 532;
Name_Implementation_Suffix : constant Name_Id := N + 533;
Name_Separate_Suffix : constant Name_Id := N + 534;
Name_Source_Files : constant Name_Id := N + 535;
Name_Source_List_File : constant Name_Id := N + 536;
Name_Default_Switches : constant Name_Id := N + 537;
Name_Switches : constant Name_Id := N + 538;
Name_Library_Dir : constant Name_Id := N + 539;
Name_Binder : constant Name_Id := N + 523;
Name_Builder : constant Name_Id := N + 524;
Name_Compiler : constant Name_Id := N + 525;
Name_Cross_Reference : constant Name_Id := N + 526;
Name_Default_Switches : constant Name_Id := N + 527;
Name_Exec_Dir : constant Name_Id := N + 528;
Name_Extends : constant Name_Id := N + 529;
Name_Finder : constant Name_Id := N + 530;
Name_Gnatls : constant Name_Id := N + 531;
Name_Gnatstub : constant Name_Id := N + 532;
Name_Implementation : constant Name_Id := N + 533;
Name_Implementation_Exceptions : constant Name_Id := N + 534;
Name_Implementation_Suffix : constant Name_Id := N + 535;
Name_Languages : constant Name_Id := N + 536;
Name_Library_Dir : constant Name_Id := N + 537;
Name_Library_Elaboration : constant Name_Id := N + 538;
Name_Library_Kind : constant Name_Id := N + 539;
Name_Library_Name : constant Name_Id := N + 540;
Name_Library_Kind : constant Name_Id := N + 541;
Name_Library_Version : constant Name_Id := N + 542;
Name_Library_Elaboration : constant Name_Id := N + 543;
Name_Languages : constant Name_Id := N + 544;
Name_Builder : constant Name_Id := N + 545;
Name_Gnatls : constant Name_Id := N + 546;
Name_Cross_Reference : constant Name_Id := N + 547;
Name_Finder : constant Name_Id := N + 548;
Name_Binder : constant Name_Id := N + 549;
Name_Linker : constant Name_Id := N + 550;
Name_Compiler : constant Name_Id := N + 551;
Name_Gnatstub : constant Name_Id := N + 552;
Name_Library_Version : constant Name_Id := N + 541;
Name_Linker : constant Name_Id := N + 542;
Name_Naming : constant Name_Id := N + 543;
Name_Object_Dir : constant Name_Id := N + 544;
Name_Project : constant Name_Id := N + 545;
Name_Separate_Suffix : constant Name_Id := N + 546;
Name_Source_Dirs : constant Name_Id := N + 547;
Name_Source_Files : constant Name_Id := N + 548;
Name_Source_List_File : constant Name_Id := N + 549;
Name_Specification : constant Name_Id := N + 550;
Name_Specification_Exceptions : constant Name_Id := N + 551;
Name_Specification_Suffix : constant Name_Id := N + 552;
Name_Switches : constant Name_Id := N + 553;
-- Mark last defined name for consistency check in Snames body
Last_Predefined_Name : constant Name_Id := N + 552;
Last_Predefined_Name : constant Name_Id := N + 553;
subtype Any_Operator_Name is Name_Id range
First_Operator_Name .. Last_Operator_Name;
......
......@@ -3993,6 +3993,15 @@ process_freeze_entity (gnat_node)
&& Present (Equivalent_Type (gnat_entity))))
return;
/* Don't do anything for subprograms that may have been elaborated before
their freeze nodes. This can happen, for example because of an inner call
in an instance body. */
if (gnu_old != 0
&& TREE_CODE (gnu_old) == FUNCTION_DECL
&& (Ekind (gnat_entity) == E_Function
|| Ekind (gnat_entity) == E_Procedure))
return;
/* If we have a non-dummy type old tree, we have nothing to do. Unless
this is the public view of a private type whose full view was not
delayed, this node was never delayed as it should have been.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment