diff options
author | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 12:08:31 +0000 |
---|---|---|
committer | sam <sam@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-14 12:08:31 +0000 |
commit | 7fc6189b0409b0c7371c0e47ef5833bdc10b94b0 (patch) | |
tree | c41b3f7f63d76e906c54bbe9a251a6d3ed8f6c3a /gcc/ada | |
parent | 536ffbf54d5c6d506131d21aa2ac5af9d7aed4b3 (diff) | |
download | gcc-7fc6189b0409b0c7371c0e47ef5833bdc10b94b0.tar.gz |
gcc/ada/
* sem_util.ads, sem_util.adb (In_Subprogram): New function.
* sem_attr.adb (Analyze_Attribute, Attribute_Old case): Use it.
gcc/testsuite/
* gnat.dg/deep_old.adb: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134260 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 9 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 6 |
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 39a458fc822..848beee0598 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +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. + 2008-04-14 Rolf Ebert <rolf.ebert.gcc@gmx.de> PR ada/20822 diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 441b394058d..ed52023e716 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3472,7 +3472,7 @@ package body Sem_Attr is Check_E0; Set_Etype (N, P_Type); - if not Is_Subprogram (Current_Scope) then + if not In_Subprogram then Error_Attr ("attribute % can only appear within subprogram", N); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 9ab77bbf9f8..3d5aa776e89 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -5365,6 +5365,15 @@ package body Sem_Util is return False; end In_Package_Body; + ------------------- + -- In_Subprogram -- + ------------------- + + function In_Subprogram return Boolean is + begin + return Current_Subprogram /= Empty; + end In_Subprogram; + -------------------------------------- -- In_Subprogram_Or_Concurrent_Unit -- -------------------------------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 519f574b2b3..d8c0b17e8d7 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -587,6 +587,12 @@ package Sem_Util is function In_Package_Body return Boolean; -- Returns True if current scope is within a package body + function In_Subprogram return Boolean; + -- Determines if the current scope is within a subprogram compilation + -- unit (inside a subprogram declaration, subprogram body, or generic + -- subprogram declaration). The test is for appearing anywhere within + -- such a construct (that is it does not need to be directly within). + function In_Subprogram_Or_Concurrent_Unit return Boolean; -- Determines if the current scope is within a subprogram compilation -- unit (inside a subprogram declaration, subprogram body, or generic |