From 5e12215f68701ac8c69515edec41d6b8369ea6c4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 21 Dec 2011 14:34:12 +0100 Subject: [PATCH] [multiple changes] 2011-12-21 Arnaud Charlet * gnat1drv.adb (Gnat1Drv): Always delete old scil files in CodePeer mode. 2011-12-21 Robert Dewar * comperr.adb: Minor reformatting. 2011-12-21 Ed Schonberg * 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 * 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 * adaint.c (__gnat_is_executable_file_attr) [_WIN32]: Add parentheses to kill warning. From-SVN: r182582 --- gcc/ada/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/ada/adaint.c | 4 ++-- gcc/ada/aspects.adb | 24 ++++++++++++++++++------ gcc/ada/aspects.ads | 18 ++++++++++++++++++ gcc/ada/comperr.adb | 18 +++++++++++++----- gcc/ada/gnat1drv.adb | 14 ++++++++------ gcc/ada/gnat_ugn.texi | 12 ++++++------ gcc/ada/prj-attr.adb | 4 ++-- gcc/ada/prj-nmsc.adb | 24 ++++++++++++------------ gcc/ada/prj.ads | 6 +++--- gcc/ada/projects.texi | 6 +++--- gcc/ada/snames.ads-tmpl | 4 ++-- 12 files changed, 113 insertions(+), 47 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3094b46a865..3172ef72429 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2011-12-21 Arnaud Charlet + + * gnat1drv.adb (Gnat1Drv): Always delete old scil files in + CodePeer mode. + +2011-12-21 Robert Dewar + + * comperr.adb: Minor reformatting. + +2011-12-21 Ed Schonberg + + * 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 + + * 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 + + * adaint.c (__gnat_is_executable_file_attr) [_WIN32]: Add parentheses + to kill warning. + 2011-12-21 Arnaud Charlet * comperr.adb (Delete_SCIL_Files): Also delete .scilx files. diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index dde33429575..4c96d56b1ce 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -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); diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 8dc9a12bccb..cd3bdc087ec 100755 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -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; diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index fe50df79421..3ce21c57a0f 100755 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -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 := diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb index 099dc8521fa..9bf83f3879d 100644 --- a/gcc/ada/comperr.adb +++ b/gcc/ada/comperr.adb @@ -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; diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 57456cc67ff..cd992513a3c 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -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; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 16b9acc9069..b39a0c360de 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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 diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb index 4682051f54e..ba569e119e6 100644 --- a/gcc/ada/prj-attr.adb +++ b/gcc/ada/prj-attr.adb @@ -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#" & diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index b018026d946..3e86850ff0f 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -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; diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads index 760e61f0a22..877f656c0cf 100644 --- a/gcc/ada/prj.ads +++ b/gcc/ada/prj.ads @@ -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 diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index 8e37751b2dc..38caaf2da47 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -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 diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index a130784b7cb..df284addb20 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -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 + $; -- 2.30.2