diff options
author | Ed Schonberg <schonberg@adacore.com> | 2012-10-01 10:24:00 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-01 12:24:00 +0200 |
commit | 3a0919e2fcf1a62ef251131295ce770c23ebe169 (patch) | |
tree | c21249d132210049e29e4dba717c83d989346e94 /gcc | |
parent | 456cbfa5316be69e864197d9efcf895c13c2292d (diff) | |
download | gcc-3a0919e2fcf1a62ef251131295ce770c23ebe169.zip gcc-3a0919e2fcf1a62ef251131295ce770c23ebe169.tar.gz gcc-3a0919e2fcf1a62ef251131295ce770c23ebe169.tar.bz2 |
checks.adb: Improve warning message.
2012-10-01 Ed Schonberg <schonberg@adacore.com>
* checks.adb: Improve warning message.
From-SVN: r191915
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/ada/checks.adb | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ddc3f4d..24d56a1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2012-10-01 Ed Schonberg <schonberg@adacore.com> + + * checks.adb: Improve warning message. + 2012-10-01 Robert Dewar <dewar@adacore.com> * checks.adb: Minor reformatting. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 06d37864..219e671 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -2250,11 +2250,20 @@ package body Checks is if Present (S) and then Get_TSS_Name (S) /= TSS_Null then return; - -- Check certainly does not apply within the predicate function - -- itself, else we have a infinite recursion. + -- If the check appears within the predicate function itself, it + -- 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 - 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 Insert_Action (N, |