aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2014-07-31 09:43:55 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 11:43:55 +0200
commite9a794351b31fd48b76e65c2dc29f534829e42cc (patch)
treee113ac5a4b45830f2790a8af96c4e8eac9a4feb8 /gcc/ada/switch-c.adb
parent7c0c194ba4cd9a9bb779075cb977cb319882bc0b (diff)
downloadgcc-e9a794351b31fd48b76e65c2dc29f534829e42cc.zip
gcc-e9a794351b31fd48b76e65c2dc29f534829e42cc.tar.gz
gcc-e9a794351b31fd48b76e65c2dc29f534829e42cc.tar.bz2
exp_ch5.adb, [...]: Minor comment correction.
2014-07-31 Robert Dewar <dewar@adacore.com> * exp_ch5.adb, freeze.adb, exp_ch3.adb: Minor comment correction. * s-arit64.adb: Minor reformatting. 2014-07-31 Robert Dewar <dewar@adacore.com> * gnat1drv.adb (Adjust_Global_Switches): Default for overflow checking is enabled except in GNAT_Mode. * switch-c.adb (Scan_Front_End_Switches): Implement -gnato0 (suppress overflow checks). From-SVN: r213327
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb56
1 files changed, 41 insertions, 15 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 76b4c5d..5cdbd41 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -953,38 +953,57 @@ package body Switch.C is
when 'o' =>
Ptr := Ptr + 1;
- Suppress_Options.Suppress (Overflow_Check) := False;
- -- Case of no digits after the -gnato
+ -- Case of -gnato0 (overflow checking turned off)
+
+ if Ptr <= Max and then Switch_Chars (Ptr) = '0' then
+ Ptr := Ptr + 1;
+ Suppress_Options.Suppress (Overflow_Check) := True;
+
+ -- We set strict mode in case overflow checking is turned
+ -- on locally (also records that we had a -gnato switch).
- if Ptr > Max or else Switch_Chars (Ptr) not in '1' .. '3' then
Suppress_Options.Overflow_Mode_General := Strict;
Suppress_Options.Overflow_Mode_Assertions := Strict;
- -- At least one digit after the -gnato
+ -- All cases other than -gnato0 (overflow checking turned on)
else
- -- Handle first digit after -gnato
-
- Suppress_Options.Overflow_Mode_General :=
- Get_Overflow_Mode (Switch_Chars (Ptr));
- Ptr := Ptr + 1;
+ Suppress_Options.Suppress (Overflow_Check) := False;
- -- Only one digit after -gnato, set assertions mode to
- -- be the same as general mode.
+ -- Case of no digits after the -gnato
if Ptr > Max
or else Switch_Chars (Ptr) not in '1' .. '3'
then
- Suppress_Options.Overflow_Mode_Assertions :=
- Suppress_Options.Overflow_Mode_General;
+ Suppress_Options.Overflow_Mode_General := Strict;
+ Suppress_Options.Overflow_Mode_Assertions := Strict;
- -- Process second digit after -gnato
+ -- At least one digit after the -gnato
else
- Suppress_Options.Overflow_Mode_Assertions :=
+ -- Handle first digit after -gnato
+
+ Suppress_Options.Overflow_Mode_General :=
Get_Overflow_Mode (Switch_Chars (Ptr));
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 '1' .. '3'
+ then
+ Suppress_Options.Overflow_Mode_Assertions :=
+ Suppress_Options.Overflow_Mode_General;
+
+ -- Process second digit after -gnato
+
+ else
+ Suppress_Options.Overflow_Mode_Assertions :=
+ Get_Overflow_Mode (Switch_Chars (Ptr));
+ Ptr := Ptr + 1;
+ end if;
end if;
end if;
@@ -1026,6 +1045,13 @@ package body Switch.C is
Validity_Checks_On := False;
Opt.Suppress_Checks := True;
+
+ -- Set overflow mode checking to strict in case it gets
+ -- turned on locally (also signals that overflow checking
+ -- has been specifically turned off).
+
+ Suppress_Options.Overflow_Mode_General := Strict;
+ Suppress_Options.Overflow_Mode_Assertions := Strict;
end if;
-- -gnatP (periodic poll)