diff options
author | Arnaud Charlet <charlet@adacore.com> | 2010-10-11 10:02:09 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-11 12:02:09 +0200 |
commit | 1b0b0f1870c7f6ee14b68d52cec2aca7f6b5084d (patch) | |
tree | 43baf9e9ccbab4d15c3921dd6055175f7fece5e6 /gcc/ada/sem_attr.adb | |
parent | ddc1515a6469f08f9b528a6aeb2827683eb1a469 (diff) | |
download | gcc-1b0b0f1870c7f6ee14b68d52cec2aca7f6b5084d.zip gcc-1b0b0f1870c7f6ee14b68d52cec2aca7f6b5084d.tar.gz gcc-1b0b0f1870c7f6ee14b68d52cec2aca7f6b5084d.tar.bz2 |
gnat_rm.texi, [...] (Analyze_Attribute, [...]): Add handling of Attribute_Ref.
2010-10-11 Arnaud Charlet <charlet@adacore.com>
* gnat_rm.texi, exp_attr.adb, sem_attr.adb, sem_attr.ads,
snames.ads-tmpl (Analyze_Attribute, Expand_N_Attribute_Reference): Add
handling of Attribute_Ref. Add missing blanks in some error messages.
(Attribute_Ref, Name_Ref): Declare.
Document 'Ref attribute.
From-SVN: r165291
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index bfddc14..75cc2db 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -2989,7 +2989,7 @@ package body Sem_Attr is Ekind (Entity (P)) /= E_Enumeration_Literal) then Error_Attr_P - ("prefix of %attribute must be " & + ("prefix of % attribute must be " & "discrete type/object or enum literal"); end if; end if; @@ -3461,7 +3461,7 @@ package body Sem_Attr is elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P)) or else UI_To_Int (Intval (E1)) < 0 then - Error_Attr ("invalid parameter number for %attribute", E1); + Error_Attr ("invalid parameter number for % attribute", E1); end if; end if; @@ -4010,6 +4010,23 @@ package body Sem_Attr is Resolve (N, Standard_Void_Type); Note_Possible_Modification (E2, Sure => True); + --------- + -- Ref -- + --------- + + when Attribute_Ref => + Check_E1; + Analyze (P); + + if Nkind (P) /= N_Expanded_Name + or else not Is_RTE (P_Type, RE_Address) + then + Error_Attr_P ("prefix of % attribute must be System.Address"); + end if; + + Analyze_And_Resolve (E1, Any_Integer); + Set_Etype (N, RTE (RE_Address)); + --------------- -- Remainder -- --------------- @@ -4405,7 +4422,7 @@ package body Sem_Attr is if Nkind (P) /= N_Identifier or else Chars (P) /= Name_System then - Error_Attr_P ("prefix of %attribute must be System"); + Error_Attr_P ("prefix of % attribute must be System"); end if; Generate_Reference (RTE (RE_Address), P); @@ -7630,6 +7647,7 @@ package body Sem_Attr is Attribute_Position | Attribute_Priority | Attribute_Read | + Attribute_Ref | Attribute_Result | Attribute_Storage_Pool | Attribute_Storage_Size | |