summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-01 14:34:58 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-01 14:34:58 +0000
commitaf6f686de1055035a20c7ed40c0cf2d586e0eaa7 (patch)
treef033d000678e4e902727d672a6202935def58ce3 /gcc/ada/sem_attr.adb
parentedf732633eb6b456e59b4f010766dd64ecf7f50f (diff)
downloadgcc-af6f686de1055035a20c7ed40c0cf2d586e0eaa7.tar.gz
2008-08-01 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r138450 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@138521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb29
1 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 14f9102d369..4b599151f8e 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1898,6 +1898,7 @@ package body Sem_Attr is
and then Aname /= Name_Address
and then Aname /= Name_Code_Address
and then Aname /= Name_Count
+ and then Aname /= Name_Result
and then Aname /= Name_Unchecked_Access
then
Error_Attr ("ambiguous prefix for % attribute", P);
@@ -3741,6 +3742,16 @@ package body Sem_Attr is
PS : constant Entity_Id := Scope (CS);
begin
+ -- If the enclosing subprogram is always inlined, the enclosing
+ -- postcondition will not be propagated to the expanded call.
+
+ if Has_Pragma_Inline_Always (PS)
+ and then Warn_On_Redundant_Constructs
+ then
+ Error_Msg_N
+ ("postconditions on inlined functions not enforced?", N);
+ end if;
+
-- If we are in the scope of a function and in Spec_Expression mode,
-- this is likely the prescan of the postcondition pragma, and we
-- just set the proper type. If there is an error it will be caught
@@ -3775,9 +3786,23 @@ package body Sem_Attr is
then
-- Check OK prefix
- if Nkind (P) /= N_Identifier
- or else Chars (P) /= Chars (PS)
+ if (Nkind (P) = N_Identifier
+ or else Nkind (P) = N_Operator_Symbol)
+ and then Chars (P) = Chars (PS)
+ then
+ null;
+
+ -- Within an instance, the prefix designates the local renaming
+ -- of the original generic.
+
+ elsif Is_Entity_Name (P)
+ and then Ekind (Entity (P)) = E_Function
+ and then Present (Alias (Entity (P)))
+ and then Chars (Alias (Entity (P))) = Chars (PS)
then
+ null;
+
+ else
Error_Msg_NE
("incorrect prefix for % attribute, expected &", P, PS);
Error_Attr;