2017-04-25 Ed Schonberg <schonberg@adacore.com>
+ * sem_util.adb (Same_Value): String literals are compile-time
+ values, and comparing them must use Expr_Value_S.
+
+2017-04-25 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <duff@adacore.com>
+
+ * 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 <kirtchev@adacore.com>
+
+ * sem_ch3.adb, sem_ch8.adb, sem_disp.adb: Minor reformatting.
+2017-04-25 Ed Schonberg <schonberg@adacore.com>
+
* 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
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;
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
-- 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.
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;
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);
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;
-- 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
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
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