summaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 08:27:31 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-01 08:27:31 +0000
commit724d2bd81f7196ce25ccc333e13b3318e7fba9f3 (patch)
treecff8f1dd541a406e11a30c3790b5f81385699ffc /gcc/ada/switch-c.adb
parentc9e9106d24d0e5c0461a95536dffd0f8cbdd6882 (diff)
downloadgcc-724d2bd81f7196ce25ccc333e13b3318e7fba9f3.tar.gz
2012-10-01 Vincent Celier <celier@adacore.com>
* make.adb (Scan_Make_Arg): Only test for "vP" of the option includes at least 3 characters. * gnatcmd.adb (GNATCmd): Ditto. 2012-10-01 Eric Botcazou <ebotcazou@adacore.com> * exp_ch7.adb, sinfo.ads: Add comments. 2012-10-01 Robert Dewar <dewar@adacore.com> * checks.adb: Remove reference to Enable_Overflow_Checks Use Suppress_Options rather than Scope_Suppress. * gnat1drv.adb (Adjust_Global_Switches): Handle new overflow settings (Adjust_Global_Switches): Initialize Scope_Suppress from Suppress_Options. * opt.adb: Remove Enable_Overflow_Checks (use Suppress_Options instead). * opt.ads: Remove Overflow_Checks_Unsuppressed (not used) Remove Enable_Overflow_Checks (use Suppress_Options instead) Suppress_Options is now current setting (replaces Scope_Suppress). * osint.adb (Initialize): Deal with initializing overflow checking. * par-prag.adb: Add dummy entry for pragma Overflow_Checks. * sem.adb (Semantics): Save and restore In_Assertion_Expr Use Suppress_Options instead of Scope_Suppress. * sem.ads (In_Assertion_Expr): New flag (Scope_Suppress): Removed, use Suppress_Options instead. * sem_eval.adb (Compile_Time_Compare): Return Unknown in preanalysis mode. * sem_prag.adb (Process_Suppress_Unsuppress): Setting of Overflow_Checks_Unsuppressed removed (not used anywhere!) (Analyze_Pragma, case Check): Set In_Assertion_Expression (Analyze_Pragma, case Overflow_Checks): Implement new pragma * snames.ads-tmpl: Add names needed for handling pragma Overflow_Checks * switch-c.adb (Scan_Front_End_Switches) Handle -gnato? and -gnato?? where ? is 0-3 * types.ads: Updates and fixes to comment on Suppress_Record. 2012-10-01 Vincent Celier <celier@adacore.com> * prj-part.adb (Parse): Remove incorrect comment about checking imported non extending projects from and "extending all" one. Minor correction. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191895 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb89
1 files changed, 77 insertions, 12 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 4815c097302..04de8900ca4 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -128,9 +128,8 @@ package body Switch.C is
-- Handle switches that do not start with -gnat
- if Ptr + 3 > Max
- or else Switch_Chars (Ptr .. Ptr + 3) /= "gnat"
- then
+ if Ptr + 3 > Max or else Switch_Chars (Ptr .. Ptr + 3) /= "gnat" then
+
-- There are two front-end switches that do not start with -gnat:
-- -I, --RTS
@@ -755,10 +754,77 @@ package body Switch.C is
when 'o' =>
Ptr := Ptr + 1;
- Suppress_Options.Suppress (Overflow_Check) := False;
- Suppress_Options.Overflow_Checks_General := Check_All;
- Suppress_Options.Overflow_Checks_Assertions := Check_All;
- Opt.Enable_Overflow_Checks := True;
+
+ -- Case of no digits after the -gnato
+
+ if Ptr > Max or else Switch_Chars (Ptr) not in '0' .. '3' then
+ Suppress_Options.Overflow_Checks_General := Checked;
+ Suppress_Options.Overflow_Checks_Assertions := Checked;
+
+ -- At least one digit after the -gnato
+
+ else
+ -- Handle first digit after -gnato
+
+ case Switch_Chars (Ptr) is
+ when '0' =>
+ Suppress_Options.Overflow_Checks_General :=
+ Suppressed;
+
+ when '1' =>
+ Suppress_Options.Overflow_Checks_General :=
+ Checked;
+
+ when '2' =>
+ Suppress_Options.Overflow_Checks_General :=
+ Minimized;
+
+ when '3' =>
+ Suppress_Options.Overflow_Checks_General :=
+ Eliminated;
+
+ when others =>
+ raise Program_Error;
+ end case;
+
+ Ptr := Ptr + 1;
+
+ -- Only one digit after -gnato, set assertions mode to
+ -- be the same as general mode.
+
+ if Ptr > Max
+ or else Switch_Chars (Ptr) not in '0' .. '3'
+ then
+ Suppress_Options.Overflow_Checks_Assertions :=
+ Suppress_Options.Overflow_Checks_General;
+
+ -- Process second digit after -gnato
+
+ else
+ case Switch_Chars (Ptr) is
+ when '0' =>
+ Suppress_Options.Overflow_Checks_Assertions :=
+ Suppressed;
+
+ when '1' =>
+ Suppress_Options.Overflow_Checks_Assertions :=
+ Checked;
+
+ when '2' =>
+ Suppress_Options.Overflow_Checks_Assertions :=
+ Minimized;
+
+ when '3' =>
+ Suppress_Options.Overflow_Checks_Assertions :=
+ Eliminated;
+
+ when others =>
+ raise Program_Error;
+ end case;
+
+ Ptr := Ptr + 1;
+ end if;
+ end if;
-- Processing for O switch
@@ -793,13 +859,12 @@ package body Switch.C is
Suppress_Options.Suppress (J) := True;
end if;
- Suppress_Options.Overflow_Checks_General := Suppress;
- Suppress_Options.Overflow_Checks_Assertions := Suppress;
+ Suppress_Options.Overflow_Checks_General := Suppressed;
+ Suppress_Options.Overflow_Checks_Assertions := Suppressed;
end loop;
- Validity_Checks_On := False;
- Opt.Suppress_Checks := True;
- Opt.Enable_Overflow_Checks := False;
+ Validity_Checks_On := False;
+ Opt.Suppress_Checks := True;
end if;
-- Processing for P switch