Commit d6fd1f07 by Arnaud Charlet

[multiple changes]

2017-05-02  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep.

2017-05-02  Vasiliy Fofanov  <fofanov@adacore.com>

	* s-os_lib.ads: Minor typo fix.

2017-05-02  Vasiliy Fofanov  <fofanov@adacore.com>

	* gnatls.adb: Merge and refactor code from Prj.Env and remove
	this deprecated dependency.

2017-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_util.ads: minor comment addition.

2017-05-02  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and
	pastos in part #3 of the head comment.

2017-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch3.adb (Freeze_Type): Do not generate an invariant
	procedure body for a local (sub)type declaration within a
	predicate function. Invariant checks do not apply to these, and
	the expansion of the procedure will happen in the wrong scope,
	leading to misplaced freeze nodes.

2017-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_util.adb (Insert_Library_Level_Action): Use proper scope
	to analyze generated actions.  If the main unit is a body,
	the required scope is that of the corresponding unit declaration.

2017-05-02  Arnaud Charlet  <charlet@adacore.com>

	* einfo.adb (Declaration_Node): flip branches of
	an IF statement to avoid repeated negations in its condition;
	no change in semantics, only to improve readability.

From-SVN: r247480
parent 2d249f52
2017-05-02 Bob Duff <duff@adacore.com>
* sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep.
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
* s-os_lib.ads: Minor typo fix.
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
* gnatls.adb: Merge and refactor code from Prj.Env and remove
this deprecated dependency.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_util.ads: minor comment addition.
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and
pastos in part #3 of the head comment.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Freeze_Type): Do not generate an invariant
procedure body for a local (sub)type declaration within a
predicate function. Invariant checks do not apply to these, and
the expansion of the procedure will happen in the wrong scope,
leading to misplaced freeze nodes.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Insert_Library_Level_Action): Use proper scope
to analyze generated actions. If the main unit is a body,
the required scope is that of the corresponding unit declaration.
2017-05-02 Arnaud Charlet <charlet@adacore.com>
* einfo.adb (Declaration_Node): flip branches of
an IF statement to avoid repeated negations in its condition;
no change in semantics, only to improve readability.
2017-05-02 Arnaud Charlet <charlet@adacore.com>
* sem_case.adb: Remove extra spaces in parameter declarations.
......
......@@ -7117,15 +7117,13 @@ package body Einfo is
end if;
loop
if Nkind (P) /= N_Selected_Component
and then Nkind (P) /= N_Expanded_Name
and then
not (Nkind (P) = N_Defining_Program_Unit_Name
and then Is_Child_Unit (Id))
if Nkind_In (P, N_Selected_Component, N_Expanded_Name)
or else (Nkind (P) = N_Defining_Program_Unit_Name
and then Is_Child_Unit (Id))
then
return P;
else
P := Parent (P);
else
return P;
end if;
end loop;
end Declaration_Node;
......
......@@ -7554,8 +7554,19 @@ package body Exp_Ch3 is
-- Non-interface types
-- Do not generate invariant procedure within other assertion
-- subprograms, which may involve local declarations of local
-- subtypes to which these checks don't apply.
elsif Has_Invariants (Def_Id) then
Build_Invariant_Procedure_Body (Def_Id);
if Within_Internal_Subprogram
or else (Ekind (Current_Scope) = E_Function
and then Is_Predicate_Function (Current_Scope))
then
null;
else
Build_Invariant_Procedure_Body (Def_Id);
end if;
end if;
Restore_Ghost_Mode (Saved_GM);
......
......@@ -7491,8 +7491,10 @@ package body Exp_Util is
Aux : constant Node_Id := Aux_Decls_Node (Cunit (Main_Unit));
begin
Push_Scope (Cunit_Entity (Main_Unit));
-- ??? should this be Current_Sem_Unit instead of Main_Unit?
Push_Scope (Cunit_Entity (Current_Sem_Unit));
-- And not Main_Unit as previously. If the main unit is a body,
-- the scope needed to analyze the actions is the entity of the
-- corresponding declaration.
if No (Actions (Aux)) then
Set_Actions (Aux, New_List (N));
......
......@@ -1177,7 +1177,9 @@ package Exp_Util is
function Within_Internal_Subprogram return Boolean;
-- Indicates that some expansion is taking place within the body of a
-- predefined primitive operation. Some expansion activity (e.g. predicate
-- checks) is disabled in such.
-- checks) is disabled in such. Because we want to detect invalid uses
-- of function calls within predicates (which lead to infinite recursion)
-- predicate functions themselves are not considered internal here.
private
pragma Inline (Duplicate_Subexpr);
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2016, Free Software Foundation, Inc. --
-- Copyright (C) 1995-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -366,7 +366,7 @@ package System.OS_Lib is
type Large_File_Size is range -2**63 .. 2**63 - 1;
-- Maximum supported size for a file (8 exabytes = 8 million terabytes,
-- should be enough to accomodate all possible needs for quite a while).
-- should be enough to accommodate all possible needs for quite a while).
function File_Length64 (FD : File_Descriptor) return Large_File_Size;
pragma Import (C, File_Length64, "__gnat_file_length");
......
......@@ -3763,13 +3763,23 @@ package body Sem_Attr is
--------------
when Attribute_Enum_Rep =>
-- T'Enum_Rep (X) case
if Present (E1) then
Check_E1;
Check_Discrete_Type;
Resolve (E1, P_Base_Type);
elsif not Is_Discrete_Type (Etype (P)) then
Error_Attr_P ("prefix of % attribute must be of discrete type");
-- X'Enum_Rep case. X must be an object or enumeration literal, and
-- it must be of a discrete type.
elsif not ((Is_Object_Reference (P)
or else (Is_Entity_Name (P)
and then Ekind (Entity (P)) =
E_Enumeration_Literal))
and then Is_Discrete_Type (Etype (P)))
then
Error_Attr_P ("prefix of % attribute must be discrete object");
end if;
Set_Etype (N, Universal_Integer);
......
......@@ -8028,7 +8028,7 @@ package body Sem_Ch3 is
-- 3. DISCRIMINANTS IN DERIVED UNTAGGED RECORD TYPES
-- We have spoken about stored discriminants in point 1 (introduction)
-- above. There are two sort of stored discriminants: implicit and
-- above. There are two sorts of stored discriminants: implicit and
-- explicit. As long as the derived type inherits the same discriminants as
-- the root record type, stored discriminants are the same as regular
-- discriminants, and are said to be implicit. However, if any discriminant
......@@ -8047,7 +8047,7 @@ package body Sem_Ch3 is
-- type T4 (Y : Int) is new T3 (Y, 99);
-- The following table summarizes the discriminants and stored
-- discriminants in R and T1 through T4.
-- discriminants in R and T1 through T4:
-- Type Discrim Stored Discrim Comment
-- R (D1, D2, D3) (D1, D2, D3) Girder discrims implicit in R
......@@ -8058,7 +8058,7 @@ package body Sem_Ch3 is
-- Field Corresponding_Discriminant (abbreviated CD below) allows us to
-- find the corresponding discriminant in the parent type, while
-- Original_Record_Component (abbreviated ORC below), the actual physical
-- Original_Record_Component (abbreviated ORC below) the actual physical
-- component that is renamed. Finally the field Is_Completely_Hidden
-- (abbreviated ICH below) is set for all explicit stored discriminants
-- (see einfo.ads for more info). For the above example this gives:
......@@ -8085,10 +8085,10 @@ package body Sem_Ch3 is
-- D2 in T3 empty itself yes
-- D3 in T3 empty itself yes
-- Y in T4 X1 in T3 D3 in T3 no
-- D1 in T3 empty itself yes
-- D2 in T3 empty itself yes
-- D3 in T3 empty itself yes
-- Y in T4 X1 in T3 D3 in T4 no
-- D1 in T4 empty itself yes
-- D2 in T4 empty itself yes
-- D3 in T4 empty itself yes
-- 4. DISCRIMINANTS IN DERIVED TAGGED RECORD TYPES
......
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