diff options
author | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 12:10:16 +0000 |
---|---|---|
committer | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 12:10:16 +0000 |
commit | 8c5c7277723524c81fb523b0e5fb8f2030594d03 (patch) | |
tree | d178755975cb10ade9ad878bce1b7c7f83670aac /gcc/ada | |
parent | 7fc6189b0409b0c7371c0e47ef5833bdc10b94b0 (diff) | |
download | gcc-8c5c7277723524c81fb523b0e5fb8f2030594d03.tar.gz |
gcc/ada/
PR ada/15915
* sem_util.ads, sem_util.adb (Denotes_Variable): New function.
* sem_ch12.adb (Instantiate_Object): Use it.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Ensure that
storage pool denotes a variable as per RM 13.11(15).
gcc/testsuite/
PR ada/15915
* gnat.dg/specs/storage.ads: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134261 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 5 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 9 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 3 |
5 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 848beee0598..9905b15ac73 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,13 @@ 2008-04-14 Samuel Tardieu <sam@rfc1149.net> + PR ada/15915 + * sem_util.ads, sem_util.adb (Denotes_Variable): New function. + * sem_ch12.adb (Instantiate_Object): Use it. + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Ensure that + storage pool denotes a variable as per RM 13.11(15). + +2008-04-14 Samuel Tardieu <sam@rfc1149.net> + * sem_util.ads, sem_util.adb (In_Subprogram): New function. * sem_attr.adb (Analyze_Attribute, Attribute_Old case): Use it. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 8728bfe4684..e7755c4f534 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -8213,7 +8213,7 @@ package body Sem_Ch12 is Resolve (Actual, Ftyp); - if not Is_Variable (Actual) or else Paren_Count (Actual) > 0 then + if not Denotes_Variable (Actual) then Error_Msg_NE ("actual for& must be a variable", Actual, Formal_Id); diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 93d66270e74..f72ffff6397 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1481,6 +1481,11 @@ package body Sem_Ch13 is Analyze_And_Resolve (Expr, Class_Wide_Type (RTE (RE_Root_Storage_Pool))); + if not Denotes_Variable (Expr) then + Error_Msg_N ("storage pool must be a variable", Expr); + return; + end if; + if Nkind (Expr) = N_Type_Conversion then T := Etype (Expression (Expr)); else diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 3d5aa776e89..e7a6658e88d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2143,6 +2143,15 @@ package body Sem_Util is end Denotes_Discriminant; + ---------------------- + -- Denotes_Variable -- + ---------------------- + + function Denotes_Variable (N : Node_Id) return Boolean is + begin + return Is_Variable (N) and then Paren_Count (N) = 0; + end Denotes_Variable; + ----------------------------- -- Depends_On_Discriminant -- ----------------------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index d8c0b17e8d7..291e230f430 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -245,6 +245,9 @@ package Sem_Util is -- components of protected types, and constraint checks on entry -- families constrained by discriminants. + function Denotes_Variable (N : Node_Id) return Boolean; + -- Returns True if node N denotes a single variable without parentheses. + function Depends_On_Discriminant (N : Node_Id) return Boolean; -- Returns True if N denotes a discriminant or if N is a range, a subtype -- indication or a scalar subtype where one of the bounds is a |