aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-12-20 15:04:19 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2011-12-20 15:04:19 +0100
commitb2009d46817f00372f7552c068c4a7eb9bf1389b (patch)
treef2e044fed041fab9a9b27874f080130846d73e28 /gcc/ada
parent2f7b74678b21c5c104c984cec26403bbefa27b76 (diff)
downloadgcc-b2009d46817f00372f7552c068c4a7eb9bf1389b.zip
gcc-b2009d46817f00372f7552c068c4a7eb9bf1389b.tar.gz
gcc-b2009d46817f00372f7552c068c4a7eb9bf1389b.tar.bz2
[multiple changes]
2011-12-20 Bob Duff <duff@adacore.com> * opt.ads (List_Inherited_Aspects): Default to False (i.e. -gnatw.L is the default). * usage.adb: Document new default for -gnatw.L. * gnat_ugn.texi: Document -gnatw.l and -gnatw.L switches. * warnsw.adb (Set_Warning_Switch): Do not include List_Inherited_Aspects in -gnatwa. 2011-12-20 Ed Schonberg <schonberg@adacore.com> * checks.adb (Apply_Type_Conversion_Checks): For a discrete type with predicates, indicate unconditionally that a range check is needed. * exp_ch4.adb (Expand_N_In): When the membership test is rewritten to incorporate a call to a predicate function, analyze expression with checks suppressed, to prevent infinite recursion. From-SVN: r182540
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog18
-rw-r--r--gcc/ada/checks.adb9
-rw-r--r--gcc/ada/exp_ch4.adb5
-rw-r--r--gcc/ada/gnat_ugn.texi14
-rw-r--r--gcc/ada/opt.ads6
-rw-r--r--gcc/ada/usage.adb4
-rw-r--r--gcc/ada/warnsw.adb1
7 files changed, 50 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 697ea3d..6502681 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,21 @@
+2011-12-20 Bob Duff <duff@adacore.com>
+
+ * opt.ads (List_Inherited_Aspects): Default to False
+ (i.e. -gnatw.L is the default).
+ * usage.adb: Document new default for -gnatw.L.
+ * gnat_ugn.texi: Document -gnatw.l and -gnatw.L switches.
+ * warnsw.adb (Set_Warning_Switch): Do not include
+ List_Inherited_Aspects in -gnatwa.
+
+2011-12-20 Ed Schonberg <schonberg@adacore.com>
+
+ * checks.adb (Apply_Type_Conversion_Checks): For a discrete type
+ with predicates, indicate unconditionally that a range check
+ is needed.
+ * exp_ch4.adb (Expand_N_In): When the membership test is rewritten
+ to incorporate a call to a predicate function, analyze expression
+ with checks suppressed, to prevent infinite recursion.
+
2011-12-20 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch11.adb (Find_Local_Handler): Guard the
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 5383bd8..059253f 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -2398,6 +2398,15 @@ package body Checks is
else
Apply_Scalar_Range_Check
(Expr, Target_Type, Fixed_Int => Conv_OK);
+
+ -- If the target type has predicates, we need to indicate
+ -- the need for a check, even if Determine_Range finds
+ -- that the value is within bounds. This may be the case
+ -- e.g for a division with a constant denominator.
+
+ if Has_Predicates (Target_Type) then
+ Enable_Range_Check (Expr);
+ end if;
end if;
end if;
end;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index f45ea08..8082cb0 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5228,10 +5228,11 @@ package body Exp_Ch4 is
Right_Opnd => Make_Predicate_Call (Rtyp, Lop)));
-- Analyze new expression, mark left operand as analyzed to
- -- avoid infinite recursion adding predicate calls.
+ -- avoid infinite recursion adding predicate calls. Similarly,
+ -- suppress further range checks on the call.
Set_Analyzed (Left_Opnd (N));
- Analyze_And_Resolve (N, Standard_Boolean);
+ Analyze_And_Resolve (N, Standard_Boolean, Suppress => All_Checks);
-- All done, skip attempt at compile time determination of result
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index d42ac09..92aba09 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -5093,6 +5093,7 @@ switch are
@option{-gnatwh} (hiding),
@option{-gnatw.h} (holes (gaps) in record layouts)
@option{-gnatwl} (elaboration warnings),
+@option{-gnatw.l} (inherited aspects),
@option{-gnatw.o} (warn on values set by out parameters ignored)
and @option{-gnatwt} (tracking of deleted conditional code).
All other optional warnings are turned on.
@@ -5424,6 +5425,19 @@ This switch suppresses warnings on missing Elaborate and Elaborate_All pragmas.
See the section in this guide on elaboration checking for details on
when such pragmas should be used.
+@item -gnatw.l
+@emph{List inherited aspects.}
+@cindex @option{-gnatw.l} (@command{gcc})
+This switch causes the compiler to list inherited invariants,
+preconditions, and postconditions from Invariant'Class, Pre'Class, and
+Post'Class aspects. Also list inherited subtype predicates.
+These messages are not automatically turned on by the use of @option{-gnatwa}.
+
+@item -gnatw.L
+@emph{Suppress listing of inherited aspects.}
+@cindex @option{-gnatw.L} (@command{gcc})
+This switch suppresses listing of inherited aspects.
+
@item -gnatwm
@emph{Activate warnings on modified but unreferenced variables.}
@cindex @option{-gnatwm} (@command{gcc})
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 4c1f560..555283c 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -801,10 +801,12 @@ package Opt is
-- Set to True to skip compile and bind steps (except when Bind_Only is
-- set to True).
- List_Inherited_Aspects : Boolean := True;
+ List_Inherited_Aspects : Boolean := False;
-- GNAT
-- List inherited invariants, preconditions, and postconditions from
- -- Invariant'Class, Pre'Class, and Post'Class aspects.
+ -- Invariant'Class, Pre'Class, and Post'Class aspects. Also list inherited
+ -- subtype predicates. Set True by use of -gnatw.l and False by use of
+ -- -gnatw.L.
List_Restrictions : Boolean := False;
-- GNATBIND
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index aa4b815..c4e7176 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -453,8 +453,8 @@ begin
"elaboration pragma");
Write_Line (" L* turn off warnings for missing " &
"elaboration pragma");
- Write_Line (" .l* turn on info messages for inherited aspects");
- Write_Line (" .L turn off info messages for inherited aspects");
+ Write_Line (" .l turn on info messages for inherited aspects");
+ Write_Line (" .L* turn off info messages for inherited aspects");
Write_Line (" m+ turn on warnings for variable assigned " &
"but not read");
Write_Line (" M* turn off warnings for variable assigned " &
diff --git a/gcc/ada/warnsw.adb b/gcc/ada/warnsw.adb
index 703ce0c..3c57767 100644
--- a/gcc/ada/warnsw.adb
+++ b/gcc/ada/warnsw.adb
@@ -251,7 +251,6 @@ package body Warnsw is
Constant_Condition_Warnings := True;
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := True;
- List_Inherited_Aspects := True;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_Assertion_Failure := True;