summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch9.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-06 07:33:43 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-06 07:33:43 +0000
commitba9b1a3986f32262a221d4cfef7f05338129df82 (patch)
tree788eee846b0d18dfe72c81fb18eb266c6f5fc50e /gcc/ada/sem_ch9.adb
parentf03ce402f3399b269d8f5d564c639f5ae76a14d3 (diff)
downloadgcc-ba9b1a3986f32262a221d4cfef7f05338129df82.tar.gz
2012-08-06 Vincent Pucci <pucci@adacore.com>
* exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body): Use of Known_Static_Esize instead of Known_Esize and Known_Static_RM_Size instead of Known_RM_Size in order to properly call UI_To_Int. Don't check the size of the component type in case of generic. * sem_ch9.adb (Allows_Lock_Free_Implementation): Use of Known_Static_Esize instead of Known_Esize and Known_Static_RM_Size instead of Known_RM_Size in order to properly call UI_To_Int. Don't check the size of the component type in case of generic. 2012-08-06 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Discrete_Range_Cond): Do not try to optimize on the assumption that the type of an expression can always fit in the target type of a conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190156 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch9.adb')
-rw-r--r--gcc/ada/sem_ch9.adb87
1 files changed, 49 insertions, 38 deletions
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 524de4ce99b..1b34c03bc86 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -528,15 +528,17 @@ package body Sem_Ch9 is
return Abandon;
- -- Quantified expression restricted
+ -- Quantified expression restricted. Note that we have
+ -- to check the original node as well, since at this
+ -- stage, it may have been rewritten.
elsif Kind = N_Quantified_Expression
- or else Nkind (Original_Node (N)) =
- N_Quantified_Expression
+ or else
+ Nkind (Original_Node (N)) = N_Quantified_Expression
then
if Lock_Free_Given then
- Error_Msg_N ("quantified expression not allowed",
- N);
+ Error_Msg_N
+ ("quantified expression not allowed", N);
return Skip;
end if;
@@ -576,45 +578,54 @@ package body Sem_Ch9 is
and then Is_List_Member (Comp_Decl)
and then List_Containing (Comp_Decl) = Priv_Decls
then
- -- Make sure the protected component type has
- -- size and alignment fields set at this point
- -- whenever this is possible.
+ -- Skip generic types since, in that case, we
+ -- will not build a body anyway (in the generic
+ -- template), and the size in the template may
+ -- have a fake value.
- Layout_Type (Comp_Type);
+ if not Is_Generic_Type (Comp_Type) then
- -- Note that Known_Esize is used and not
- -- Known_Static_Esize in order to capture the
- -- errors properly at the instantiation point.
+ -- Make sure the protected component type has
+ -- size and alignment fields set at this
+ -- point whenever this is possible.
- if Known_Esize (Comp_Type) then
- Comp_Size := UI_To_Int (Esize (Comp_Type));
+ Layout_Type (Comp_Type);
- -- If the Esize (Object_Size) is unknown at
- -- compile-time, look at the RM_Size
- -- (Value_Size) since it may have been set by an
- -- explicit representation clause.
+ if Known_Static_Esize (Comp_Type) then
+ Comp_Size := UI_To_Int (Esize (Comp_Type));
- elsif Known_RM_Size (Comp_Type) then
- Comp_Size := UI_To_Int (RM_Size (Comp_Type));
- end if;
+ -- If the Esize (Object_Size) is unknown at
+ -- compile-time, look at the RM_Size
+ -- (Value_Size) since it may have been set by
+ -- an explicit representation clause.
+
+ elsif Known_Static_RM_Size (Comp_Type) then
+ Comp_Size :=
+ UI_To_Int (RM_Size (Comp_Type));
- -- Check that the size of the component is 8,
- -- 16, 32 or 64 bits.
-
- case Comp_Size is
- when 8 | 16 | 32 | 64 =>
- null;
- when others =>
- if Lock_Free_Given then
- Error_Msg_NE
- ("type of& must support atomic " &
- "operations",
- N, Comp_Id);
- return Skip;
- end if;
-
- return Abandon;
- end case;
+ -- Worrisome missing else raise PE???
+ end if;
+
+ -- Check that the size of the component is 8,
+ -- 16, 32 or 64 bits.
+
+ -- What about AAMP here???
+
+ case Comp_Size is
+ when 8 | 16 | 32 | 64 =>
+ null;
+ when others =>
+ if Lock_Free_Given then
+ Error_Msg_NE
+ ("type of& must support atomic " &
+ "operations",
+ N, Comp_Id);
+ return Skip;
+ end if;
+
+ return Abandon;
+ end case;
+ end if;
-- Check if another protected component has
-- already been accessed by the subprogram body.