aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gnat1drv.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-06-23 12:27:31 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-06-23 12:27:31 +0200
commit14e339993e97e2f8b35b6279dd1402cdcf4b8742 (patch)
treef0311b1e502afa7ff259258722c48b933768c5bf /gcc/ada/gnat1drv.adb
parentb6d83244a33d27cfbe781ea4ce693cd9280f1860 (diff)
downloadgcc-14e339993e97e2f8b35b6279dd1402cdcf4b8742.zip
gcc-14e339993e97e2f8b35b6279dd1402cdcf4b8742.tar.gz
gcc-14e339993e97e2f8b35b6279dd1402cdcf4b8742.tar.bz2
[multiple changes]
2009-06-23 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Valid_Conversion, Full_Designated_Type): Use Available_View only when designated type of an anonymous access type is limited view. 2009-06-23 Robert Dewar <dewar@adacore.com> * sem_ch10.adb: Minor reformatting * gnat1drv.adb (Adjust_Global_Switches): New procedure (take care of turning off inlining if ASIS mode active). * switch-c.adb: Remove fiddling with Inspector_Mode and ASIS_Mode This belongs in gnat1drv.adb after switches are scanned. From-SVN: r148846
Diffstat (limited to 'gcc/ada/gnat1drv.adb')
-rw-r--r--gcc/ada/gnat1drv.adb201
1 files changed, 123 insertions, 78 deletions
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 4dec895..93f2297 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -83,6 +83,13 @@ procedure Gnat1drv is
Back_End_Mode : Back_End.Back_End_Mode_Type;
-- Record back end mode
+ procedure Adjust_Global_Switches;
+ -- There are various interactions between front end switch settings,
+ -- including debug switch settings and target dependent parameters.
+ -- This procedure takes care of properly handling these interactions.
+ -- We do it after scanning out all the switches, that way we are not
+ -- depending on the order in which switches appear.
+
procedure Check_Bad_Body;
-- Called to check if the unit we are compiling has a bad body
@@ -95,6 +102,121 @@ procedure Gnat1drv is
pragma Warnings (Off, Check_Library_Items);
-- In case the call below is commented out
+ ----------------------------
+ -- Adjust_Global_Switches --
+ ----------------------------
+
+ procedure Adjust_Global_Switches is
+ begin
+
+ -- Set ASIS mode if -gnatt and -gnatc are set
+
+ if Operating_Mode = Check_Semantics and then Tree_Output then
+ ASIS_Mode := True;
+
+ -- Turn off inlining in ASIS mode, since ASIS cannot handle the extra
+ -- information in the trees caused by inlining being active.
+
+ -- More specifically, the tree seems to malformed from the ASIS point
+ -- of view if -gnatc and -gnatn appear together ???
+
+ Inline_Active := False;
+
+ -- Turn off inspector mode in ASIS mode. For reasons that need
+ -- clearer documentation, Inspector cannot function in this mode ???
+
+ Inspector_Mode := False;
+ end if;
+
+ -- Inspeector mode requires back-end rep info and also needs to disable
+ -- front-end inlining (but -gnatn does not need to be disabled).
+
+ if Inspector_Mode then
+ Back_Annotate_Rep_Info := True;
+ Front_End_Inlining := False;
+ end if;
+
+ -- Set Configurable_Run_Time mode if system.ads flag set
+
+ if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
+ Configurable_Run_Time_Mode := True;
+ end if;
+
+ -- Set -gnatR3m mode if debug flag A set
+
+ if Debug_Flag_AA then
+ Back_Annotate_Rep_Info := True;
+ List_Representation_Info := 1;
+ List_Representation_Info_Mechanisms := True;
+ end if;
+
+ -- Force Target_Strict_Alignment true if debug flag -gnatd.a is set
+
+ if Debug_Flag_Dot_A then
+ Ttypes.Target_Strict_Alignment := True;
+ end if;
+
+ -- Disable static allocation of dispatch tables if -gnatd.t or if layout
+ -- is enabled. The front end's layout phase currently treats types that
+ -- have discriminant-dependent arrays as not being static even when a
+ -- discriminant constraint on the type is static, and this leads to
+ -- problems with subtypes of type Ada.Tags.Dispatch_Table_Wrapper. ???
+
+ if Debug_Flag_Dot_T or else Frontend_Layout_On_Target then
+ Static_Dispatch_Tables := False;
+ end if;
+
+ -- Flip endian mode if -gnatd8 set
+
+ if Debug_Flag_8 then
+ Ttypes.Bytes_Big_Endian := not Ttypes.Bytes_Big_Endian;
+ end if;
+
+ -- Deal with forcing OpenVMS switches True if debug flag M is set, but
+ -- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target
+ -- before doing this, so we know if we are in real openVMS or not!
+
+ Opt.True_VMS_Target := Targparm.OpenVMS_On_Target;
+
+ if Debug_Flag_M then
+ Targparm.OpenVMS_On_Target := True;
+ Hostparm.OpenVMS := True;
+ end if;
+
+ -- Activate front end layout if debug flag -gnatdF is set
+
+ if Debug_Flag_FF then
+ Targparm.Frontend_Layout_On_Target := True;
+ end if;
+
+ -- Set and check exception mechnism
+
+ if Targparm.ZCX_By_Default_On_Target then
+ if Targparm.GCC_ZCX_Support_On_Target then
+ Exception_Mechanism := Back_End_Exceptions;
+ else
+ Osint.Fail ("Zero Cost Exceptions not supported on this target");
+ end if;
+ end if;
+
+ -- Set proper status for overflow checks. We turn on overflow checks
+ -- if -gnatp was not specified, and either -gnato is set or the back
+ -- end takes care of overflow checks. Otherwise we suppress overflow
+ -- checks by default (since front end checks are expensive).
+
+ if not Opt.Suppress_Checks
+ and then (Opt.Enable_Overflow_Checks
+ or else
+ (Targparm.Backend_Divide_Checks_On_Target
+ and
+ Targparm.Backend_Overflow_Checks_On_Target))
+ then
+ Suppress_Options (Overflow_Check) := False;
+ else
+ Suppress_Options (Overflow_Check) := True;
+ end if;
+ end Adjust_Global_Switches;
+
--------------------
-- Check_Bad_Body --
--------------------
@@ -359,35 +481,7 @@ begin
Restrict.Restrictions := Targparm.Restrictions_On_Target;
end;
- -- Set Configurable_Run_Time mode if system.ads flag set
-
- if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
- Configurable_Run_Time_Mode := True;
- end if;
-
- -- Set -gnatR3m mode if debug flag A set
-
- if Debug_Flag_AA then
- Back_Annotate_Rep_Info := True;
- List_Representation_Info := 1;
- List_Representation_Info_Mechanisms := True;
- end if;
-
- -- Force Target_Strict_Alignment true if debug flag -gnatd.a is set
-
- if Debug_Flag_Dot_A then
- Ttypes.Target_Strict_Alignment := True;
- end if;
-
- -- Disable static allocation of dispatch tables if -gnatd.t or if layout
- -- is enabled. The front end's layout phase currently treats types that
- -- have discriminant-dependent arrays as not being static even when a
- -- discriminant constraint on the type is static, and this leads to
- -- problems with subtypes of type Ada.Tags.Dispatch_Table_Wrapper. ???
-
- if Debug_Flag_Dot_T or else Frontend_Layout_On_Target then
- Static_Dispatch_Tables := False;
- end if;
+ Adjust_Global_Switches;
-- Output copyright notice if full list mode unless we have a list
-- file, in which case we defer this so that it is output in the file
@@ -405,55 +499,6 @@ begin
Write_Eol;
end if;
- -- Before we do anything else, adjust certain global values for
- -- debug switches which modify their normal natural settings.
-
- if Debug_Flag_8 then
- Ttypes.Bytes_Big_Endian := not Ttypes.Bytes_Big_Endian;
- end if;
-
- -- Deal with forcing OpenVMS switches Ture if debug flag M is set, but
- -- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target
- -- before doing this.
-
- Opt.True_VMS_Target := Targparm.OpenVMS_On_Target;
-
- if Debug_Flag_M then
- Targparm.OpenVMS_On_Target := True;
- Hostparm.OpenVMS := True;
- end if;
-
- if Debug_Flag_FF then
- Targparm.Frontend_Layout_On_Target := True;
- end if;
-
- -- We take the default exception mechanism into account
-
- if Targparm.ZCX_By_Default_On_Target then
- if Targparm.GCC_ZCX_Support_On_Target then
- Exception_Mechanism := Back_End_Exceptions;
- else
- Osint.Fail ("Zero Cost Exceptions not supported on this target");
- end if;
- end if;
-
- -- Set proper status for overflow checks. We turn on overflow checks
- -- if -gnatp was not specified, and either -gnato is set or the back
- -- end takes care of overflow checks. Otherwise we suppress overflow
- -- checks by default (since front end checks are expensive).
-
- if not Opt.Suppress_Checks
- and then (Opt.Enable_Overflow_Checks
- or else
- (Targparm.Backend_Divide_Checks_On_Target
- and
- Targparm.Backend_Overflow_Checks_On_Target))
- then
- Suppress_Options (Overflow_Check) := False;
- else
- Suppress_Options (Overflow_Check) := True;
- end if;
-
-- Check we do not have more than one source file, this happens only in
-- the case where the driver is called directly, it cannot happen when
-- gnat1 is invoked from gcc in the normal case.