+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
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;
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
@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.
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})
-- 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
"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 " &
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;