aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/bcheck.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2008-03-26 08:36:02 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2008-03-26 08:36:02 +0100
commit1b24ada5aba090c1b641353f94cba86730c99105 (patch)
tree70dbf93da9aba2214e551ac66d758a30077cf351 /gcc/ada/bcheck.adb
parent9fbecd1a76ba3508fac12e5795923d6ca9efe309 (diff)
ali.ads, ali.adb (Optimize_Alignment_Setting): New field in ALI record
2008-03-26 Robert Dewar <dewar@adacore.com> * ali.ads, ali.adb (Optimize_Alignment_Setting): New field in ALI record * bcheck.adb (Check_Consistent_Optimize_Alignment): New procedure * debug.adb: Add debug flags d.r and d.v Add debug flag .T (Optimize_Alignment (Time)) Add debug flag .S (Optimize_Alignment (Space)) * freeze.adb (Freeze_Record_Type): Set OK_To_Reorder_Components depending on setting of relevant debug flags. Replace use of Warnings_Off by Has_Warnings_Off (Freeze_Entity): In circuit for warning on suspicious convention actuals, do not give warning if subprogram has same entity as formal type, or if subprogram does not come from source. (Freeze_Entity): Don't reset Is_Packed for fully rep speced record if Optimize_Alignment set to Space. * frontend.adb: Add call to Sem_Warn.Initialize Add call to Sem_Warn.Output_Unused_Warnings_Off_Warnings Reset Optimize_Alignment mode from debug switches .S and .T * layout.adb (Layout_Composite_Object): Rewritten for Optimize_Aligment pragma. * lib-writ.ads, lib-writ.adb: New Ox parameter for Optimize_Alignment mode. * opt.ads, opt.adb: (Optimize_Alignment): New global switch * par-prag.adb (N_Pragma): Chars field removed, use Chars (Pragma_Identifier (.. instead, adjustments throughout to accomodate this change. Add entry for pragma Optimize_Alignment * sem_prag.adb (N_Pragma): Chars field removed, use Chars (Pragma_Identifier (.. instead, adjustments throughout to accomodate this change. (Process_Compile_Time_Warning_Or_Error): Use !! for generated msg (Favor_Top_Level): Use new function Is_Access_Subprogram_Type Add implementation of pragma Optimize_Alignment From-SVN: r133549
Diffstat (limited to 'gcc/ada/bcheck.adb')
-rw-r--r--gcc/ada/bcheck.adb52
1 files changed, 45 insertions, 7 deletions
diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb
index adab9588cf2..c397cc8dc92 100644
--- a/gcc/ada/bcheck.adb
+++ b/gcc/ada/bcheck.adb
@@ -51,6 +51,7 @@ package body Bcheck is
procedure Check_Consistent_Interrupt_States;
procedure Check_Consistent_Locking_Policy;
procedure Check_Consistent_Normalize_Scalars;
+ procedure Check_Consistent_Optimize_Alignment;
procedure Check_Consistent_Queuing_Policy;
procedure Check_Consistent_Restrictions;
procedure Check_Consistent_Zero_Cost_Exception_Handling;
@@ -86,8 +87,8 @@ package body Bcheck is
end if;
Check_Consistent_Normalize_Scalars;
+ Check_Consistent_Optimize_Alignment;
Check_Consistent_Dynamic_Elaboration_Checking;
-
Check_Consistent_Restrictions;
Check_Consistent_Interrupt_States;
Check_Consistent_Dispatching_Policy;
@@ -657,12 +658,11 @@ package body Bcheck is
-- then all other units in the partition must also be compiled with
-- Normalized_Scalars in effect.
- -- There is some issue as to whether this consistency check is
- -- desirable, it is certainly required at the moment by the RM.
- -- We should keep a watch on the ARG and HRG deliberations here.
- -- GNAT no longer depends on this consistency (it used to do so,
- -- but that has been corrected in the latest version, since the
- -- Initialize_Scalars pragma does not require consistency.
+ -- There is some issue as to whether this consistency check is desirable,
+ -- it is certainly required at the moment by the RM. We should keep a watch
+ -- on the ARG and HRG deliberations here. GNAT no longer depends on this
+ -- consistency (it used to do so, but that is no longer the case, since
+ -- pragma Initialize_Scalars pragma does not require consistency.)
procedure Check_Consistent_Normalize_Scalars is
begin
@@ -696,6 +696,44 @@ package body Bcheck is
end if;
end Check_Consistent_Normalize_Scalars;
+ -----------------------------------------
+ -- Check_Consistent_Optimize_Alignment --
+ -----------------------------------------
+
+ -- The rule is that all units other than internal units must be compiled
+ -- with the same setting for Optimize_Alignment. We can exclude internal
+ -- units since they are forced to compile with Optimize_Alignment (Off).
+
+ procedure Check_Consistent_Optimize_Alignment is
+ OA_Setting : Character := ' ';
+ -- Reset when we find a non-internal unit
+
+ OA_Unit : ALI_Id;
+ -- Id of unit from which OA_Setting was set
+
+ begin
+ for A in ALIs.First .. ALIs.Last loop
+ if not Is_Internal_File_Name (ALIs.Table (A).Afile) then
+ if OA_Setting = ' ' then
+ OA_Setting := ALIs.Table (A).Optimize_Alignment_Setting;
+ OA_Unit := A;
+
+ elsif OA_Setting = ALIs.Table (A).Optimize_Alignment_Setting then
+ null;
+
+ else
+ Error_Msg_File_1 := ALIs.Table (OA_Unit).Sfile;
+ Error_Msg_File_2 := ALIs.Table (A).Sfile;
+
+ Consistency_Error_Msg
+ ("{ and { compiled with different "
+ & "Optimize_Alignment settings");
+ return;
+ end if;
+ end if;
+ end loop;
+ end Check_Consistent_Optimize_Alignment;
+
-------------------------------------
-- Check_Consistent_Queuing_Policy --
-------------------------------------