aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/exp_ch3.adb4
-rw-r--r--gcc/ada/exp_ch5.adb2
-rw-r--r--gcc/ada/freeze.adb4
-rw-r--r--gcc/ada/gnat1drv.adb12
-rw-r--r--gcc/ada/s-arit64.adb14
-rw-r--r--gcc/ada/switch-c.adb56
7 files changed, 73 insertions, 31 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 91dd3cd..1bf5222 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+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).
+
2014-07-31 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Expand_Freeze_Record_Type): Do not build an
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 44bac81..60d4ba7 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1752,7 +1752,7 @@ package body Exp_Ch3 is
-- objects on list Decls.
function Build_Init_Call_Thru (Parameters : List_Id) return List_Id;
- -- Given a untagged type-derivation that declares discriminants, e.g.
+ -- Given an untagged type-derivation that declares discriminants, e.g.
--
-- type R (R1, R2 : Integer) is record ... end record;
-- type D (D1 : Integer) is new R (1, D1);
@@ -5838,7 +5838,7 @@ package body Exp_Ch3 is
-- Handle C++ constructor calls. Note that we do not check that
-- Typ is a tagged type since the equivalent Ada type of a C++
- -- class that has no virtual methods is a untagged limited
+ -- class that has no virtual methods is an untagged limited
-- record type.
elsif Is_CPP_Constructor_Call (Expr) then
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 978a1e9..94f6cd9 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -106,7 +106,7 @@ package body Exp_Ch5 is
-- using the standard Insert_Actions mechanism.
procedure Expand_Assign_Record (N : Node_Id);
- -- N is an assignment of a untagged record value. This routine handles
+ -- N is an assignment of an untagged record value. This routine handles
-- the case where the assignment must be made component by component,
-- either because the target is not byte aligned, or there is a change
-- of representation, or when we have a tagged type with a representation
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index aad4761..99464b8 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -4537,8 +4537,8 @@ package body Freeze is
return No_List;
end if;
- -- Check for error of Type_Invariant'Class applied to a untagged type
- -- (check delayed to freeze time when full type is available).
+ -- Check for error of Type_Invariant'Class applied to an untagged
+ -- type (check delayed to freeze time when full type is available).
declare
Prag : constant Node_Id := Get_Pragma (E, Pragma_Invariant);
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 14dc0ee..353f6d0 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -511,9 +511,13 @@ procedure Gnat1drv is
-- Otherwise set overflow mode defaults
else
- -- Otherwise set overflow checks off by default
+ -- Overflow checks are on by default (Suppress set False) except in
+ -- GNAT_Mode, where we want them off by default (we are not ready to
+ -- enable overflow checks in the compiler yet, for one thing the case
+ -- of 64-bit checks needs System.Arith_64 which is not a compiler
+ -- unit and it is a pain to try to include it in the compiler.
- Suppress_Options.Suppress (Overflow_Check) := True;
+ Suppress_Options.Suppress (Overflow_Check) := GNAT_Mode;
-- Set appropriate default overflow handling mode. Note: at present
-- we set STRICT in all three of the following cases. They are
@@ -531,8 +535,8 @@ procedure Gnat1drv is
-- flags set, so this was dead code anyway.
elsif Targparm.Backend_Divide_Checks_On_Target
- and
- Targparm.Backend_Overflow_Checks_On_Target
+ and
+ Targparm.Backend_Overflow_Checks_On_Target
then
Suppress_Options.Overflow_Mode_General := Strict;
Suppress_Options.Overflow_Mode_Assertions := Strict;
diff --git a/gcc/ada/s-arit64.adb b/gcc/ada/s-arit64.adb
index 51b05f9..adcb66f 100644
--- a/gcc/ada/s-arit64.adb
+++ b/gcc/ada/s-arit64.adb
@@ -259,8 +259,8 @@ package body System.Arith_64 is
T2 := 0;
end if;
- -- Here we have T2 set to the contribution to the upper half
- -- of the result from the upper halves of the input values.
+ -- Here we have T2 set to the contribution to the upper half of the
+ -- result from the upper halves of the input values.
T1 := Xlo * Ylo;
T2 := T2 + Hi (T1);
@@ -332,9 +332,9 @@ package body System.Arith_64 is
Scale : Natural;
-- Scaling factor used for multiple-precision divide. Dividend and
- -- Divisor are multiplied by 2 ** Scale, and the final remainder
- -- is divided by the scaling factor. The reason for this scaling
- -- is to allow more accurate estimation of quotient digits.
+ -- Divisor are multiplied by 2 ** Scale, and the final remainder is
+ -- divided by the scaling factor. The reason for this scaling is to
+ -- allow more accurate estimation of quotient digits.
T1, T2, T3 : Uns64;
-- Temporary values
@@ -383,8 +383,8 @@ package body System.Arith_64 is
D (1) := 0;
end if;
- -- Now it is time for the dreaded multiple precision division. First
- -- an easy case, check for the simple case of a one digit divisor.
+ -- Now it is time for the dreaded multiple precision division. First an
+ -- easy case, check for the simple case of a one digit divisor.
if Zhi = 0 then
if D (1) /= 0 or else D (2) >= Zlo then
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)