From 45969c973faf786d16c198c42c4055903d08658f Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 23 Oct 2015 10:46:27 +0000 Subject: [PATCH] gnat1drv.adb (Adjust_Global_Switches): Adjust settings. 2015-10-23 Arnaud Charlet * gnat1drv.adb (Adjust_Global_Switches): Adjust settings. * sem.adb (Semantics): Remove special case. From-SVN: r229230 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gnat1drv.adb | 24 +++++++++++++++++++++--- gcc/ada/restrict.adb | 6 ++---- gcc/ada/sem.adb | 4 ---- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5235631e069..b66d29ff12b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2015-10-23 Arnaud Charlet + + * gnat1drv.adb (Adjust_Global_Switches): Adjust settings. + * sem.adb (Semantics): Remove special case. + 2015-10-23 Gary Dismukes * bindgen.adb, restrict.adb: Minor spelling/grammar fixes. diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index bd3af2ef271..88cc9c0b8b0 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -136,17 +136,34 @@ procedure Gnat1drv is Unnest_Subprogram_Mode := True; end if; - -- -gnatd.V or -gnatd.u enables special C expansion mode + -- -gnatd.u enables special C expansion mode - if Debug_Flag_Dot_VV or Debug_Flag_Dot_U then + if Debug_Flag_Dot_U then Modify_Tree_For_C := True; end if; - -- Other flags set if we are generating C code + -- Set all flags required when generating C code (-gnatd.V) if Debug_Flag_Dot_VV then Generate_C_Code := True; + Modify_Tree_For_C := True; Unnest_Subprogram_Mode := True; + + -- Enable some restrictions systematically to simplify the generated + -- code. Note that restriction checks are also disabled in C mode, + -- see Restrict.Check_Restriction. + + Restrict.Restrictions.Set (No_Exception_Registration) := True; + Restrict.Restrictions.Set (No_Initialize_Scalars) := True; + Restrict.Restrictions.Set (No_Task_Hierarchy) := True; + Restrict.Restrictions.Set (No_Abort_Statements) := True; + Restrict.Restrictions.Set (Max_Asynchronous_Select_Nesting) := True; + Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0; + + -- Set operating mode to Generate_Code to benefit from full front-end + -- expansion (e.g. generics). + + Operating_Mode := Generate_Code; end if; -- -gnatd.E sets Error_To_Warning mode, causing selected error messages @@ -229,6 +246,7 @@ procedure Gnat1drv is -- user specified Restrictions pragmas are ignored, see -- Sem_Prag.Process_Restrictions_Or_Restriction_Warnings. + Restrict.Restrictions.Set (No_Exception_Registration) := True; Restrict.Restrictions.Set (No_Initialize_Scalars) := True; Restrict.Restrictions.Set (No_Task_Hierarchy) := True; Restrict.Restrictions.Set (No_Abort_Statements) := True; diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index b63b426d096..aaaaf40bb0a 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -505,16 +505,14 @@ package body Restrict is -- In GNATprove mode restrictions are checked, except for -- No_Initialize_Scalars, which is implicitly set in gnat1drv.adb. - -- Just checking, SPARK does not allow restrictions to be set ??? - if CodePeer_Mode or else (GNATprove_Mode and then R = No_Initialize_Scalars) then return; end if; - -- In SPARK mode, issue an error for any use of class-wide, even if the - -- No_Dispatch restriction is not set. + -- In SPARK 05 mode, issue an error for any use of class-wide, even if + -- the No_Dispatch restriction is not set. if R = No_Dispatch then Check_SPARK_05_Restriction ("class-wide is not allowed", N); diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index a6f1be13b3b..819bcd5d959 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1446,10 +1446,6 @@ package body Sem is or else Debug_Flag_X - -- Or if we are generating C code - - or else Generate_C_Code - -- Or if in configuration run-time mode. We do this so we get -- error messages about missing entities in the run-time even -- if we are compiling in -gnatc (no code generation) mode. -- 2.30.2