aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb35
1 files changed, 29 insertions, 6 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 0dc2e4f..0d9f20a 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -11995,6 +11995,26 @@ package body Sem_Prag is
if Is_First_Subtype (E) and then Etype (E) /= E then
Suppress_Unsuppress_Echeck (Etype (E), C);
end if;
+
+ -- For the alignment check of an object with an address clause,
+ -- we want the pragma to be taken into account even if it comes
+ -- after the address clause:
+
+ -- A : Integer;
+ -- for A'Address use ...
+ -- pragma Suppress (Alignment_Check, A);
+
+ -- When there is also an alignment clause, the check is generated
+ -- unconditionally, see Analyze_Attribute_Definition_Clause.
+
+ if C = Alignment_Check
+ and then not Is_Type (E)
+ and then Present (Address_Clause (E))
+ and then No (Alignment_Clause (E))
+ then
+ Set_Check_Address_Alignment
+ (Address_Clause (E), not Suppress_Case);
+ end if;
end Suppress_Unsuppress_Echeck;
-- Start of processing for Process_Suppress_Unsuppress
@@ -16449,8 +16469,6 @@ package body Sem_Prag is
or else not Is_Access_Type (Entity (Arg))
then
Error_Pragma_Arg ("pragma% requires access type", Arg1);
- else
- Set_Has_Pragma_Controlled (Base_Type (Entity (Arg)));
end if;
end Controlled;
@@ -16569,7 +16587,7 @@ package body Sem_Prag is
-- Check if already defined as constructor
- if Is_Constructor (Def_Id) then
+ if Is_CPP_Constructor (Def_Id) then
Error_Msg_N
("??duplicate argument for pragma 'C'P'P_Constructor", Arg1);
return;
@@ -16594,7 +16612,7 @@ package body Sem_Prag is
end if;
Set_Has_Completion (Def_Id);
- Set_Is_Constructor (Def_Id);
+ Set_Is_CPP_Constructor (Def_Id);
Set_Convention (Def_Id, Convention_CPP);
-- Imported C++ constructors are not dispatching primitives
@@ -28154,7 +28172,9 @@ package body Sem_Prag is
return;
elsif not Is_Integer_Type (E)
- or else Is_Modular_Integer_Type (E)
+ or else
+ (Is_Modular_Integer_Type (E)
+ and then not Has_Unsigned_Base_Range_Aspect (Base_Type (E)))
then
Error_Pragma_Arg
("cannot apply pragma %",
@@ -28193,7 +28213,10 @@ package body Sem_Prag is
Set_First_Subtype_Link (Freeze_Node (Base_Type (E)), E);
Set_Has_Delayed_Freeze (E);
- Set_Has_Unsigned_Base_Range_Aspect (Base_Type (E));
+ -- Attribute Has_Unsigned_Base_Range_Aspect must have been
+ -- set by Unsigned_Base_Range_Type_Declaration or inherited
+ -- by Build_Derived_Numeric_Type.
+ pragma Assert (Has_Unsigned_Base_Range_Aspect (Base_Type (E)));
end if;
end Unsigned_Base_Range;