Commit 5e12215f by Arnaud Charlet

[multiple changes]

2011-12-21  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb (Gnat1Drv): Always delete old scil files in
	CodePeer mode.

2011-12-21  Robert Dewar  <dewar@adacore.com>

	* comperr.adb: Minor reformatting.

2011-12-21  Ed Schonberg  <schonberg@adacore.com>

	* aspects.ads: New table Base_Aspect, to indicate that an aspect
	is defined on a base type.
	* aspects.adb (Find_Aspect): If the aspect is a Base_Aspect,
	examine the representation items of the base type.

2011-12-21  Pascal Obry  <obry@adacore.com>

	* gnat_ugn.texi, prj.ads, prj-nmsc.adb, prj-attr.adb, projects.texi,
	snames.ads-tmpl: Use Encapsulated instead of Fully Standalone library.

2011-12-21  Pascal Obry  <obry@adacore.com>

	* adaint.c (__gnat_is_executable_file_attr) [_WIN32]: Add parentheses
	to kill warning.

From-SVN: r182582
parent 427f99e2
2011-12-21 Arnaud Charlet <charlet@adacore.com>
* gnat1drv.adb (Gnat1Drv): Always delete old scil files in
CodePeer mode.
2011-12-21 Robert Dewar <dewar@adacore.com>
* comperr.adb: Minor reformatting.
2011-12-21 Ed Schonberg <schonberg@adacore.com>
* aspects.ads: New table Base_Aspect, to indicate that an aspect
is defined on a base type.
* aspects.adb (Find_Aspect): If the aspect is a Base_Aspect,
examine the representation items of the base type.
2011-12-21 Pascal Obry <obry@adacore.com>
* gnat_ugn.texi, prj.ads, prj-nmsc.adb, prj-attr.adb, projects.texi,
snames.ads-tmpl: Use Encapsulated instead of Fully Standalone library.
2011-12-21 Pascal Obry <obry@adacore.com>
* adaint.c (__gnat_is_executable_file_attr) [_WIN32]: Add parentheses
to kill warning.
2011-12-21 Arnaud Charlet <charlet@adacore.com>
* comperr.adb (Delete_SCIL_Files): Also delete .scilx files.
Fix implementation for child packages and package specs.
(Delete_SCIL_Files.Decode_Name_Buffer): New function.
......
......@@ -2189,10 +2189,10 @@ __gnat_is_executable_file_attr (char* name, struct file_attributes* attr)
/* look for last .exe */
if (last)
while (l = _tcsstr(last+1, _T(".exe"))) last = l;
while ((l = _tcsstr(last+1, _T(".exe")))) last = l;
attr->executable = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES
&& last - wname == (int) (_tcslen (wname) - 4);
&& (last - wname) == (int) (_tcslen (wname) - 4);
}
#else
__gnat_stat_to_attr (-1, name, attr);
......
......@@ -125,17 +125,29 @@ package body Aspects is
function Find_Aspect (Ent : Entity_Id; A : Aspect_Id) return Node_Id is
Ritem : Node_Id;
Typ : Entity_Id;
begin
-- If the aspect is an inherited one and the entity is a class-wide
-- type, use the aspect of the specific type.
-- type, use the aspect of the specific type. If the type is a base
-- aspect, examine the rep. items of the base type.
if Is_Type (Ent) then
if Base_Aspect (A) then
Typ := Base_Type (Ent);
else
Typ := Ent;
end if;
if Is_Class_Wide_Type (Typ)
and then Inherited_Aspect (A)
then
Ritem := First_Rep_Item (Etype (Typ));
else
Ritem := First_Rep_Item (Typ);
end if;
if Is_Type (Ent)
and then Is_Class_Wide_Type (Ent)
and then Inherited_Aspect (A)
then
Ritem := First_Rep_Item (Etype (Ent));
else
Ritem := First_Rep_Item (Ent);
end if;
......
......@@ -147,6 +147,24 @@ package Aspects is
Aspect_Post => True,
others => False);
-- The following array indicates aspects that a subtype inherits from
-- its base type. True means that the subtype inherits the aspect from
-- its base type. False means it is not inherited.
Base_Aspect : constant array (Aspect_Id) of Boolean :=
(Aspect_Atomic => True,
Aspect_Atomic_Components => True,
Aspect_Discard_Names => True,
Aspect_Independent_Components => True,
Aspect_Iterator_Element => True,
Aspect_Constant_Indexing => True,
Aspect_Default_Iterator => True,
Aspect_Type_Invariant => True,
Aspect_Unchecked_Union => True,
Aspect_Variable_Indexing => True,
Aspect_Volatile => True,
others => False);
-- The following array identifies all implementation defined aspects
Impl_Defined_Aspects : constant array (Aspect_Id) of Boolean :=
......
......@@ -440,7 +440,8 @@ package body Comperr is
procedure Delete_SCIL_Files is
Main : Node_Id;
Unit_Name : Node_Id;
Success : Boolean;
Success : Boolean;
pragma Unreferenced (Success);
procedure Decode_Name_Buffer;
......@@ -451,9 +452,12 @@ package body Comperr is
------------------------
procedure Decode_Name_Buffer is
J : Natural := 1;
K : Natural := 0;
J : Natural;
K : Natural;
begin
J := 1;
K := 0;
while J <= Name_Len loop
K := K + 1;
......@@ -473,6 +477,8 @@ package body Comperr is
Name_Len := K;
end Decode_Name_Buffer;
-- Start of processing for Decode_Name_Buffer
begin
-- If parsing was not successful, no Main_Unit is available, so return
-- immediately.
......@@ -493,8 +499,9 @@ package body Comperr is
when N_Package_Body =>
Unit_Name := Corresponding_Spec (Main);
-- Should never happen, but can be ignored in production
when others =>
-- Should never happen, but can be ignored in production
pragma Assert (False);
return;
end case;
......@@ -507,8 +514,9 @@ package body Comperr is
Get_Name_String (Chars (Defining_Identifier (Unit_Name)));
Decode_Name_Buffer;
-- Should never happen, but can be ignored in production
when others =>
-- Should never happen, but can be ignored in production
pragma Assert (False);
return;
end case;
......
......@@ -832,6 +832,14 @@ begin
Main_Kind := Nkind (Unit (Main_Unit_Node));
Check_Bad_Body;
-- In CodePeer mode we always delete old SCIL files before regenerating
-- new ones, in case of e.g. errors, and also to remove obsolete scilx
-- files generated by CodePeer itself.
if CodePeer_Mode then
Comperr.Delete_SCIL_Files;
end if;
-- Exit if compilation errors detected
Errout.Finalize (Last_Call => False);
......@@ -851,12 +859,6 @@ begin
Tree_Gen;
end if;
-- In CodePeer mode we delete SCIL files if there is an error
if CodePeer_Mode then
Comperr.Delete_SCIL_Files;
end if;
Errout.Finalize (Last_Call => True);
Exit_Program (E_Errors);
end if;
......
......@@ -16360,26 +16360,26 @@ imported from Ada units outside of the library. If other units are imported,
the binding phase will fail.
@noindent
It is also possible to build a fully stand-alone library where not only
It is also possible to build an encapsulated library where not only
the code to elaborate and finalize the library is embedded but also
ensuring that the library is linked only against static
libraries. So a fully stand-alone library only depends on system
libraries. So an encapsulated library only depends on system
libraries, all other code, including the GNAT runtime, is embedded. To
build a fully stand-alone library the attribute
@code{Library_Standalone} must be set to @code{full}:
build an encapsulated library the attribute
@code{Library_Standalone} must be set to @code{encapsulated}:
@smallexample @c projectfile
@group
for Library_Dir use "lib_dir";
for Library_Name use "dummy";
for Library_Interface use ("int1", "int1.child");
for Library_Standalone use "full";
for Library_Standalone use "encapsulated";
@end group
@end smallexample
@noindent
The default value for this attribute is @code{standard} in which case
a not fully stand-alone library is built.
a stand-alone library is built.
The attribute @code{Library_Src_Dir} may be specified for a
Stand-Alone Library. @code{Library_Src_Dir} is a simple attribute that has a
......
......@@ -106,8 +106,8 @@ package body Prj.Attr is
"SVlibrary_version#" &
"LVlibrary_interface#" &
"SVlibrary_standalone#" &
"LVlibrary_fully_standalone_options#" &
"SVlibrary_fully_standalone_supported#" &
"LVlibrary_encapsulated_options#" &
"SVlibrary_encapsulated_supported#" &
"SVlibrary_auto_init#" &
"LVleading_library_options#" &
"LVlibrary_options#" &
......
......@@ -2220,12 +2220,12 @@ package body Prj.Nmsc is
end;
elsif
Attribute.Name = Name_Library_Fully_Standalone_Supported
Attribute.Name = Name_Library_Encapsulated_Supported
then
declare
pragma Unsuppress (All_Checks);
begin
Project.Config.Lib_Fully_Standalone_Supported :=
Project.Config.Lib_Encapsulated_Supported :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
......@@ -2233,7 +2233,7 @@ package body Prj.Nmsc is
(Data.Flags,
"invalid value """
& Get_Name_String (Attribute.Value.Value)
& """ for Library_Fully_Standalone_Supported",
& """ for Library_Encapsulated_Supported",
Attribute.Value.Location, Project);
end;
......@@ -2955,11 +2955,10 @@ package body Prj.Nmsc is
elsif Project.Library_Kind /= Static
and then not Lib_Standalone.Default
and then Get_Name_String (Lib_Standalone.Value) = "full"
and then Get_Name_String (Lib_Standalone.Value) = "encapsulated"
and then Proj.Library_Kind /= Static
then
-- A fully standalone library must depend only on static
-- libraries.
-- An encapsulated library must depend only on static libraries
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Proj.Name;
......@@ -2967,16 +2966,17 @@ package body Prj.Nmsc is
Error_Msg
(Data.Flags,
Continuation.all &
"standalone library project %% cannot import shared " &
"encapsulated library project %% cannot import shared " &
"library project %%",
Project.Location, Project);
Continuation := Continuation_String'Access;
elsif Project.Library_Kind /= Static
and then Proj.Library_Kind = Static
and then (Lib_Standalone.Default
or else
Get_Name_String (Lib_Standalone.Value) /= "full")
and then
(Lib_Standalone.Default
or else
Get_Name_String (Lib_Standalone.Value) /= "encapsulated")
then
Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Proj.Name;
......@@ -4532,8 +4532,8 @@ package body Prj.Nmsc is
if Name_Buffer (1 .. Name_Len) = "standard" then
Project.Standalone_Library := Standard;
elsif Name_Buffer (1 .. Name_Len) = "full" then
Project.Standalone_Library := Full;
elsif Name_Buffer (1 .. Name_Len) = "encapsulated" then
Project.Standalone_Library := Encapsulated;
elsif Name_Buffer (1 .. Name_Len) = "no" then
Project.Standalone_Library := No;
......
......@@ -1033,7 +1033,7 @@ package Prj is
-- The level of library support. Specified in the configuration. Support
-- is none, static libraries only or both static and shared libraries.
Lib_Fully_Standalone_Supported : Boolean := False;
Lib_Encapsulated_Supported : Boolean := False;
-- True when building fully standalone libraries supported on the target
Archive_Builder : Name_List_Index := No_Name_List;
......@@ -1106,7 +1106,7 @@ package Prj is
Resp_File_Format => None,
Resp_File_Options => No_Name_List,
Lib_Support => None,
Lib_Fully_Standalone_Supported => False,
Lib_Encapsulated_Supported => False,
Archive_Builder => No_Name_List,
Archive_Builder_Append_Option => No_Name_List,
Archive_Indexer => No_Name_List,
......@@ -1151,7 +1151,7 @@ package Prj is
-- The following record describes a project file representation
type Standalone is (No, Standard, Full);
type Standalone is (No, Standard, Encapsulated);
type Project_Data (Qualifier : Project_Qualifier := Unspecified) is record
......
......@@ -1781,8 +1781,8 @@ two attributes that make a project a Library Project (@code{Library_Name} and
@cindex @code{Library_Standalone}
This attribute defines the kind of standalone library to
build. Values are either @code{standard} (the default), @code{no} or
@code{full}. When @code{standard} is used the code to elaborate and
finalize the library is embedded, when @code{full} is used the
@code{encapsulated}. When @code{standard} is used the code to elaborate and
finalize the library is embedded, when @code{encapsulated} is used the
library can furthermore only depends on static libraries (including
the GNAT runtime). This attribute can be set to @code{no} to make it clear
that the library should not be standalone in which case the
......@@ -1793,7 +1793,7 @@ two attributes that make a project a Library Project (@code{Library_Name} and
for Library_Dir use "lib";
for Library_Name use "loggin";
for Library_Interface use ("lib1", "lib2"); -- unit names
for Library_Standalone use "full";
for Library_Standalone use "encapsulated";
@end group
@end smallexample
......
......@@ -1160,8 +1160,8 @@ package Snames is
Name_Library_Partial_Linker : constant Name_Id := N + $;
Name_Library_Reference_Symbol_File : constant Name_Id := N + $;
Name_Library_Standalone : constant Name_Id := N + $;
Name_Library_Fully_Standalone_Options : constant Name_Id := N + $;
Name_Library_Fully_Standalone_Supported : constant Name_Id := N + $; -- GB
Name_Library_Encapsulated_Options : constant Name_Id := N + $;
Name_Library_Encapsulated_Supported : constant Name_Id := N + $; -- GB
Name_Library_Src_Dir : constant Name_Id := N + $;
Name_Library_Support : constant Name_Id := N + $;
Name_Library_Symbol_File : constant Name_Id := N + $;
......
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