Commit 3a0919e2 by Ed Schonberg Committed by Arnaud Charlet

checks.adb: Improve warning message.

2012-10-01  Ed Schonberg  <schonberg@adacore.com>

	* checks.adb: Improve warning message.

From-SVN: r191915
parent 456cbfa5
2012-10-01 Ed Schonberg <schonberg@adacore.com>
* checks.adb: Improve warning message.
2012-10-01 Robert Dewar <dewar@adacore.com> 2012-10-01 Robert Dewar <dewar@adacore.com>
* checks.adb: Minor reformatting. * checks.adb: Minor reformatting.
......
...@@ -2250,11 +2250,20 @@ package body Checks is ...@@ -2250,11 +2250,20 @@ package body Checks is
if Present (S) and then Get_TSS_Name (S) /= TSS_Null then if Present (S) and then Get_TSS_Name (S) /= TSS_Null then
return; return;
-- Check certainly does not apply within the predicate function -- If the check appears within the predicate function itself, it
-- itself, else we have a infinite recursion. -- means that the user specified a check whose formal is the
-- predicated subtype itself, rather than some covering type. This
-- is likely to be a common error, and thus deserves a warning.
elsif S = Predicate_Function (Typ) then elsif S = Predicate_Function (Typ) then
return; Error_Msg_N
("predicate check includes a function call that "
& "requires a predicate check?", Parent (N));
Error_Msg_N
("\this will result in infinite recursion?", Parent (N));
Insert_Action (N,
Make_Raise_Storage_Error
(Sloc (N), Reason => SE_Infinite_Recursion));
else else
Insert_Action (N, Insert_Action (N,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment