aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-20 14:34:24 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-20 14:34:24 +0200
commitc206e8fd96c4a15826d2b9e3b0620cb31bb4b175 (patch)
tree1b76c5327d29f638f11d48cfe4dcdd83c9235d99
parent5987e59ca5bb18dc8eaa20e820e46fa6df59b6d4 (diff)
downloadgcc-c206e8fd96c4a15826d2b9e3b0620cb31bb4b175.zip
gcc-c206e8fd96c4a15826d2b9e3b0620cb31bb4b175.tar.gz
gcc-c206e8fd96c4a15826d2b9e3b0620cb31bb4b175.tar.bz2
sem_ch3.adb, [...]: Minor reformatting
* sem_ch3.adb, sem_ch6.adb: Minor reformatting * adaint.c (__gnat_is_readable_file): Check for file existence when not using ACL (always the case on remote drives). From-SVN: r146406
-rw-r--r--gcc/ada/adaint.c2
-rw-r--r--gcc/ada/sem_ch3.adb132
-rw-r--r--gcc/ada/sem_ch6.adb4
3 files changed, 66 insertions, 72 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 24719cf..e78440a 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1956,7 +1956,7 @@ __gnat_is_readable_file (char *name)
return __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping);
}
else
- return 1;
+ return GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES;
#else
int ret;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 3fc35a2..45c483a 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5527,14 +5527,14 @@ package body Sem_Ch3 is
-- derived from the full view of the parent, and hopefully has
-- known discriminants.
- -- If the full view of the parent type has its underlying record view
- -- available then use it to generate the underlying record view of
- -- this Derived_Type (required to handle chains of derivations with
- -- unknown discriminants).
+ -- If the full view of the parent type has an underlying record view,
+ -- use it to generate the underlying record view of this derived type
+ -- (required for chains of derivations with unknown discriminants).
- -- Minor optimization: We avoid the generation of useless underlying
+ -- Minor optimization: we avoid the generation of useless underlying
-- record view entities if the private type declaration has unknown
- -- discriminants but its corresponding full view has no discriminants
+ -- discriminants but its corresponding full view has no
+ -- discriminants.
if Has_Unknown_Discriminants (Parent_Type)
and then Present (Full_P)
@@ -5575,8 +5575,8 @@ package body Sem_Ch3 is
Set_Has_Private_Declaration (Full_Der);
Set_Has_Private_Declaration (Derived_Type);
- -- If the parent type has its underlying record view then we
- -- force here its use to derive the new underlying record view.
+ -- If the parent type has an underlying record view, use it
+ -- here to build the new underlying record view.
if Present (Underlying_Record_View (Full_P)) then
pragma Assert
@@ -5590,12 +5590,11 @@ package body Sem_Ch3 is
Install_Visible_Declarations (Par_Scope);
Insert_After (N, Decl);
- -- Mark the entity as underlying record view before its
- -- analysis. Done to avoid the generation of its list of
- -- primitives (which is not really required for this entity)
- -- and thus avoid supurious errors associated with missing
- -- overriding of its abstract primitives (because they are
- -- overriden in the list of primitives of Derived_Type).
+ -- Mark entity as an underlying record view before analysis,
+ -- to avoid generating the list of its primitive operations
+ -- (which is not really required for this entity) and thus
+ -- prevent spurious errors associated with missing overriding
+ -- of abstract primitives (overridden only for Derived_Type).
Set_Ekind (Full_Der, E_Record_Type);
Set_Is_Underlying_Record_View (Full_Der);
@@ -5607,20 +5606,19 @@ package body Sem_Ch3 is
Uninstall_Declarations (Par_Scope);
- -- Freeze the underlying record view, to prevent generation
- -- of useless dispatching information, which is simply shared
- -- with the real derived type.
+ -- Freeze the underlying record view, to prevent generation of
+ -- useless dispatching information, which is simply shared with
+ -- the real derived type.
Set_Is_Frozen (Full_Der);
- -- Keep fully linked the real entity and its underlying record
- -- view entity
+ -- Set up links between real entity and underlying record view
Set_Underlying_Record_View (Derived_Type, Base_Type (Full_Der));
Set_Underlying_Record_View (Base_Type (Full_Der), Derived_Type);
end;
- -- if discriminants are known, build derived record
+ -- If discriminants are known, build derived record
else
Build_Derived_Record_Type
@@ -5645,12 +5643,12 @@ package body Sem_Ch3 is
Insert_After (N, Full_Decl);
else
- -- If this is a completion, the full view being built is
- -- itself private. We build a subtype of the parent with
- -- the same constraints as this full view, to convey to the
- -- back end the constrained components and the size of this
- -- subtype. If the parent is constrained, its full view can
- -- serve as the underlying full view of the derived type.
+ -- If this is a completion, the full view being built is itself
+ -- private. We build a subtype of the parent with the same
+ -- constraints as this full view, to convey to the back end the
+ -- constrained components and the size of this subtype. If the
+ -- parent is constrained, its full view can serve as the
+ -- underlying full view of the derived type.
if No (Discriminant_Specifications (N)) then
if Nkind (Subtype_Indication (Type_Definition (N))) =
@@ -5666,7 +5664,7 @@ package body Sem_Ch3 is
else
-- If there are new discriminants, the parent subtype is
-- constrained by them, but it is not clear how to build
- -- the underlying_full_view in this case ???
+ -- the Underlying_Full_View in this case???
null;
end if;
@@ -5678,9 +5676,7 @@ package body Sem_Ch3 is
Build_Derived_Record_Type
(N, Parent_Type, Derived_Type, Derive_Subps);
- if Present (Full_View (Parent_Type))
- and then not Is_Completion
- then
+ if Present (Full_View (Parent_Type)) and then not Is_Completion then
if not In_Open_Scopes (Par_Scope)
or else not In_Same_Source_Unit (N, Parent_Type)
then
@@ -5710,8 +5706,8 @@ package body Sem_Ch3 is
end if;
else
- -- If full view of parent is tagged, the completion
- -- inherits the proper primitive operations.
+ -- If full view of parent is tagged, the completion inherits
+ -- the proper primitive operations.
Set_Defining_Identifier (Full_Decl, Full_Der);
Build_Derived_Record_Type
@@ -5732,13 +5728,12 @@ package body Sem_Ch3 is
Set_Full_View (Der_Base, Base_Type (Full_Der));
-- Copy the discriminant list from full view to the partial views
- -- (base type and its subtype). Gigi requires that the partial
- -- and full views have the same discriminants.
+ -- (base type and its subtype). Gigi requires that the partial and
+ -- full views have the same discriminants.
-- Note that since the partial view is pointing to discriminants
-- in the full view, their scope will be that of the full view.
- -- This might cause some front end problems and need
- -- adjustment???
+ -- This might cause some front end problems and need adjustment???
Discr := First_Discriminant (Base_Type (Full_Der));
Set_First_Entity (Der_Base, Discr);
@@ -5756,10 +5751,10 @@ package body Sem_Ch3 is
Set_Stored_Constraint (Full_Der, Stored_Constraint (Derived_Type));
else
- -- If this is a completion, the derived type stays private
- -- and there is no need to create a further full view, except
- -- in the unusual case when the derivation is nested within a
- -- child unit, see below.
+ -- If this is a completion, the derived type stays private and
+ -- there is no need to create a further full view, except in the
+ -- unusual case when the derivation is nested within a child unit,
+ -- see below.
null;
end if;
@@ -5777,14 +5772,14 @@ package body Sem_Ch3 is
return;
end if;
- -- If full view of parent is a record type, Build full view as
- -- a derivation from the parent's full view. Partial view remains
- -- private. For code generation and linking, the full view must
- -- have the same public status as the partial one. This full view
- -- is only needed if the parent type is in an enclosing scope, so
- -- that the full view may actually become visible, e.g. in a child
- -- unit. This is both more efficient, and avoids order of freezing
- -- problems with the added entities.
+ -- If full view of parent is a record type, build full view as a
+ -- derivation from the parent's full view. Partial view remains
+ -- private. For code generation and linking, the full view must have
+ -- the same public status as the partial one. This full view is only
+ -- needed if the parent type is in an enclosing scope, so that the
+ -- full view may actually become visible, e.g. in a child unit. This
+ -- is both more efficient, and avoids order of freezing problems with
+ -- the added entities.
if not Is_Private_Type (Full_View (Parent_Type))
and then (In_Open_Scopes (Scope (Parent_Type)))
@@ -5809,8 +5804,8 @@ package body Sem_Ch3 is
Derive_Subps => False);
end if;
- -- In any case, the primitive operations are inherited from
- -- the parent type, not from the internal full view.
+ -- In any case, the primitive operations are inherited from the
+ -- parent type, not from the internal full view.
Set_Etype (Base_Type (Derived_Type), Base_Type (Parent_Type));
@@ -5832,8 +5827,7 @@ package body Sem_Ch3 is
and then Present (Full_View (Parent_Type))
and then not Is_Tagged_Type (Full_View (Parent_Type))
then
- Error_Msg_N
- ("cannot add discriminants to untagged type", N);
+ Error_Msg_N ("cannot add discriminants to untagged type", N);
end if;
Set_Stored_Constraint (Derived_Type, No_Elist);
@@ -5850,13 +5844,13 @@ package body Sem_Ch3 is
(Base_Type (Derived_Type), Finalize_Storage_Only (Parent_Type));
end if;
- -- Construct the implicit full view by deriving from full view of
- -- the parent type. In order to get proper visibility, we install
- -- the parent scope and its declarations.
+ -- Construct the implicit full view by deriving from full view of the
+ -- parent type. In order to get proper visibility, we install the
+ -- parent scope and its declarations.
- -- ??? if the parent is untagged private and its completion is
- -- tagged, this mechanism will not work because we cannot derive
- -- from the tagged full view unless we have an extension
+ -- ??? If the parent is untagged private and its completion is
+ -- tagged, this mechanism will not work because we cannot derive from
+ -- the tagged full view unless we have an extension.
if Present (Full_View (Parent_Type))
and then not Is_Tagged_Type (Full_View (Parent_Type))
@@ -5905,7 +5899,7 @@ package body Sem_Ch3 is
Set_Is_Frozen (Full_Der, False);
Set_Freeze_Node (Full_Der, Empty);
Set_Depends_On_Private (Full_Der,
- Has_Private_Component (Full_Der));
+ Has_Private_Component (Full_Der));
Set_Public_Status (Full_Der);
end if;
end if;
@@ -5929,11 +5923,11 @@ package body Sem_Ch3 is
and then Scope (Parent_Type) /= Current_Scope
then
-- This is the unusual case where a type completed by a private
- -- derivation occurs within a package nested in a child unit,
- -- and the parent is declared in an ancestor. In this case, the
- -- full view of the parent type will become visible in the body
- -- of the enclosing child, and only then will the current type
- -- be possibly non-private. We build a underlying full view that
+ -- derivation occurs within a package nested in a child unit, and
+ -- the parent is declared in an ancestor. In this case, the full
+ -- view of the parent type will become visible in the body of the
+ -- enclosing child, and only then will the current type be
+ -- possibly non-private. We build a underlying full view that
-- will be installed when the enclosing child body is compiled.
Full_Der :=
@@ -7121,8 +7115,8 @@ package body Sem_Ch3 is
Set_Is_Controlled (Derived_Type, Is_Controlled (Parent_Base));
end if;
- -- Minor optimization: There is no need to generate the class wide
- -- entity associated with an underlying record view
+ -- Minor optimization: there is no need to generate the class-wide
+ -- entity associated with an underlying record view.
if not Is_Underlying_Record_View (Derived_Type) then
Make_Class_Wide_Type (Derived_Type);
@@ -7322,8 +7316,8 @@ package body Sem_Ch3 is
end if;
end if;
- -- Update the class_wide type, which shares the now-completed entity
- -- list with its specific type. In case of underlying record views
+ -- Update the class-wide type, which shares the now-completed entity
+ -- list with its specific type. In case of underlying record views,
-- we do not generate the corresponding class wide entity.
if Is_Tagged
@@ -13189,7 +13183,7 @@ package body Sem_Ch3 is
Error_Msg_N ("null exclusion can only apply to an access type", N);
end if;
- -- Avoid deriving parent primitives in underlying record views
+ -- Avoid deriving parent primitives of underlying record views
Build_Derived_Type (N, Parent_Type, T, Is_Completion,
Derive_Subps => not Is_Underlying_Record_View (T));
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 2670c3d..9ef4522 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -583,8 +583,8 @@ package body Sem_Ch6 is
Error_Msg_N ("must use anonymous access type", Subtype_Ind);
end if;
- -- Subtype_indication case; check that the types are the same, and
- -- statically match if appropriate. Handle also record types with
+ -- Subtype indication case: check that the types are the same, and
+ -- statically match if appropriate. Also handle record types with
-- unknown discriminants for which we have built the underlying
-- record view.