From: Arnaud Charlet Date: Tue, 25 Apr 2017 12:03:43 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f34c90bb2ca334c7e8fab6b23b1e0499fafb161;p=gcc.git [multiple changes] 2017-04-25 Ed Schonberg * sem_util.adb (Same_Value): String literals are compile-time values, and comparing them must use Expr_Value_S. 2017-04-25 Ed Schonberg * sem_ch4.adb (Complete_Object_Interpretation): If an explicit dereference is introduced for the object, and the object is overloaded, do not check whether it is aliased, because it may include an implicit dereference. * sem_type.adb (Disambiguate): If two interpretations are access attribute types with the same designated type keep either of them and do not report an ambiguity. A true ambiguity will be reported elsewhere. 2017-04-25 Bob Duff * a-numeri.ads: Change the encoding of Greek letter Pi from brackets encoding to UTF-8. Use pragma Wide_Character_Encoding to indicate the encoding. We considered using a byte order mark (BOM), but that causes various trouble (misc software eats the BOM, if you have a patch with a BOM, then it's not at the start of the patch, so it's not a BOM, the BOM affects with-ing files, etc.). * scng.adb, s-wchcnv.adb: Minor. 2017-04-25 Hristian Kirtchev * sem_ch3.adb, sem_ch8.adb, sem_disp.adb: Minor reformatting. From-SVN: r247197 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 842af1f9939..e5f69a10e85 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,35 @@ 2017-04-25 Ed Schonberg + * sem_util.adb (Same_Value): String literals are compile-time + values, and comparing them must use Expr_Value_S. + +2017-04-25 Ed Schonberg + + * sem_ch4.adb (Complete_Object_Interpretation): If an explicit + dereference is introduced for the object, and the object is + overloaded, do not check whether it is aliased, because it may + include an implicit dereference. + * sem_type.adb (Disambiguate): If two interpretations are access + attribute types with the same designated type keep either of + them and do not report an ambiguity. A true ambiguity will be + reported elsewhere. + +2017-04-25 Bob Duff + + * a-numeri.ads: Change the encoding of Greek letter Pi from + brackets encoding to UTF-8. Use pragma Wide_Character_Encoding + to indicate the encoding. We considered using a byte order mark + (BOM), but that causes various trouble (misc software eats the + BOM, if you have a patch with a BOM, then it's not at the start + of the patch, so it's not a BOM, the BOM affects with-ing files, + etc.). + * scng.adb, s-wchcnv.adb: Minor. + +2017-04-25 Hristian Kirtchev + + * sem_ch3.adb, sem_ch8.adb, sem_disp.adb: Minor reformatting. +2017-04-25 Ed Schonberg + * sem_ch3.adb (Add_Internal_Interface_Entities): Move Has_Non_Trivial_Precondition to sem_util. for use elsewhere. Improve error message on operations that inherit non-conforming diff --git a/gcc/ada/a-numeri.ads b/gcc/ada/a-numeri.ads index 805fa5670ba..c4f4f848b55 100644 --- a/gcc/ada/a-numeri.ads +++ b/gcc/ada/a-numeri.ads @@ -18,14 +18,20 @@ package Ada.Numerics is Argument_Error : exception; + pragma Wide_Character_Encoding (UTF8); + -- For the Greek letter Pi below. Note that this pragma cannot immediately + -- precede that character, because then the encoding gets set too late. + Pi : constant := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511; - ["03C0"] : constant := Pi; + π : constant := Pi; -- This is the Greek letter Pi (for Ada 2005 AI-388). Note that it is -- conforming to have this constant present even in Ada 95 mode, as there -- is no way for a normal mode Ada 95 program to reference this identifier. + pragma Wide_Character_Encoding (BRACKETS); + e : constant := 2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996; diff --git a/gcc/ada/s-wchcnv.adb b/gcc/ada/s-wchcnv.adb index 07ccc5cb348..ffbb991b2da 100644 --- a/gcc/ada/s-wchcnv.adb +++ b/gcc/ada/s-wchcnv.adb @@ -93,7 +93,7 @@ package body System.WCh_Cnv is W := Shift_Left (W, 6) or (U and 2#00111111#); end Get_UTF_Byte; - -- Start of processing for Char_Sequence_To_Wide + -- Start of processing for Char_Sequence_To_UTF_32 begin case EM is diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 3f1c3a9eb53..2b35c9a0260 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -2533,10 +2533,12 @@ package body Scng is -- End loop past format effectors. The exit from this loop is by -- executing a return statement following completion of token scan - -- (control never falls out of this loop to the code which follows) + -- (control never falls out of this loop to the code that follows). end loop; + pragma Assert (False); + -- Wide_Character scanning routine. On entry we have encountered the -- initial character of a wide character sequence. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 7a0feef8c25..464900f015e 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1737,19 +1737,21 @@ package body Sem_Ch3 is and then Has_Non_Trivial_Precondition (Iface_Prim) then if Is_Abstract_Subprogram (Prim) - or else (Ekind (Prim) = E_Procedure - and then - Nkind (Parent (Prim)) = N_Procedure_Specification - and then Null_Present (Parent (Prim))) + or else + (Ekind (Prim) = E_Procedure + and then Nkind (Parent (Prim)) = + N_Procedure_Specification + and then Null_Present (Parent (Prim))) then null; -- The inherited operation must be overridden elsif not Comes_From_Source (Prim) then - Error_Msg_NE ("&inherits non-conforming preconditions " - & "and must be overridden (RM 6.1.1 (10-16)", - Parent (Tagged_Type), Prim); + Error_Msg_NE + ("&inherits non-conforming preconditions and must " + & "be overridden (RM 6.1.1 (10-16)", + Parent (Tagged_Type), Prim); end if; end if; end; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 7787d11afd0..d7aba502cf2 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -8448,7 +8448,12 @@ package body Sem_Ch4 is Attribute_Name => Name_Access, Prefix => Relocate_Node (Obj))); - if not Is_Aliased_View (Obj) then + -- If the object is not overloaded verify that taking access of + -- it is legal. Otherwise check is made during resolution. + + if not Is_Overloaded (Obj) + and then not Is_Aliased_View (Obj) + then Error_Msg_NE ("object in prefixed call to & must be aliased " & "(RM 4.1.3 (13 1/2))", Prefix (First_Actual), Subprog); diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 4c7de392d93..a5c9d4cb921 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -3197,11 +3197,12 @@ package body Sem_Ch8 is begin if Present (Prev) and then - (Has_Non_Trivial_Precondition (Prev) - or else Has_Non_Trivial_Precondition (Old_S)) + (Has_Non_Trivial_Precondition (Prev) + or else Has_Non_Trivial_Precondition (Old_S)) then - Error_Msg_NE ("conflicting inherited classwide preconditions " - & "in renaming of& (RM 6.1.1 (17)", N, Old_S); + Error_Msg_NE + ("conflicting inherited classwide preconditions in renaming " + & "of& (RM 6.1.1 (17)", N, Old_S); end if; end; end if; diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index e322894fd6b..68e3e1e3356 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -575,7 +575,7 @@ package body Sem_Disp is -- but will be legal in overridings of the operation. elsif (Is_Subprogram (Scop) - or else Chars (Scop) = Name_Postcondition) + or else Chars (Scop) = Name_Postcondition) and then (Is_Abstract_Subprogram (Scop) or else diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 26415ae47db..d14535a768a 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -1933,6 +1933,18 @@ package body Sem_Type is return No_Interp; end if; + -- Two access attribute types may have been created for an expression + -- with an implicit dereference, which is automatically overloaded. + -- If both access attribute types designate the same object type, + -- disambiguation if any will take place elsewhere, so keep any one of + -- the interpretations. + + elsif Ekind (It1.Typ) = E_Access_Attribute_Type + and then Ekind (It2.Typ) = E_Access_Attribute_Type + and then Designated_Type (It1.Typ) = Designated_Type (It2.Typ) + then + return It1; + -- If two user defined-subprograms are visible, it is a true ambiguity, -- unless one of them is an entry and the context is a conditional or -- timed entry call, or unless we are within an instance and this is diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 34ef713319a..753098c0c1a 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -20102,9 +20102,17 @@ package body Sem_Util is begin if Compile_Time_Known_Value (Node1) and then Compile_Time_Known_Value (Node2) - and then Expr_Value (Node1) = Expr_Value (Node2) then - return True; + -- Handle properly compile-time expressions that are not + -- scalar. + + if Is_String_Type (Etype (Node1)) then + return Expr_Value_S (Node1) = Expr_Value_S (Node2); + + else + return Expr_Value (Node1) = Expr_Value (Node2); + end if; + elsif Same_Object (Node1, Node2) then return True; else