aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch11.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-20 14:32:21 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-20 14:32:21 +0200
commit744c73a51853327efa19b0abe14b208511d071f1 (patch)
tree2b73749a207274e9fa458dcff11244fce39124e7 /gcc/ada/sem_ch11.adb
parent9fe696a3b387562aceca53cdf20f46e3bfe0d2b4 (diff)
downloadgcc-744c73a51853327efa19b0abe14b208511d071f1.zip
gcc-744c73a51853327efa19b0abe14b208511d071f1.tar.gz
gcc-744c73a51853327efa19b0abe14b208511d071f1.tar.bz2
[multiple changes]
2015-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch11.adb (Analyze_Handled_Statements): If the scope is a postcondition subprogram, do not check for useless assignments because there are no source references in such a body, and the call will lose deferred references from the enclosing subprogram. 2015-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb: nalyze_Attribute_Definition_Clause, case 'Address): If either object is controlled the overlay is erroneous, but analysis must be completed so that back-end sees address clause and completes code generation. Improve text of warning. 2015-10-20 Thomas Quinot <quinot@adacore.com> * exp_ch4.adb: Minor reformatting. From-SVN: r229072
Diffstat (limited to 'gcc/ada/sem_ch11.adb')
-rw-r--r--gcc/ada/sem_ch11.adb9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index 86285ee..0b9f8ef 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -46,6 +46,7 @@ with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
+with Snames; use Snames;
with Stand; use Stand;
package body Sem_Ch11 is
@@ -417,9 +418,13 @@ package body Sem_Ch11 is
-- If the current scope is a subprogram, then this is the right place to
-- check for hanging useless assignments from the statement sequence of
- -- the subprogram body.
+ -- the subprogram body. Skip this in the body of a postcondition,
+ -- since in that case there are no source references, and we need to
+ -- preserve deferred references from the enclosing scope.
- if Is_Subprogram (Current_Scope) then
+ if Is_Subprogram (Current_Scope)
+ and then Chars (Current_Scope) /= Name_uPostconditions
+ then
Warn_On_Useless_Assignments (Current_Scope);
end if;