diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-09-10 17:12:42 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-09-10 17:12:42 +0200 |
commit | 80e59506c2065fe2f4550644e0fbf2b585ab5be3 (patch) | |
tree | 039c8844fa257a96041b0dabfdfdb9b94b398349 /gcc/ada/aspects.adb | |
parent | 4bb9c7b9ed2ddc21915fd41fcac2bd0b77609c7c (diff) | |
download | gcc-80e59506c2065fe2f4550644e0fbf2b585ab5be3.zip gcc-80e59506c2065fe2f4550644e0fbf2b585ab5be3.tar.gz gcc-80e59506c2065fe2f4550644e0fbf2b585ab5be3.tar.bz2 |
[multiple changes]
2013-09-10 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze_Pragma, case SPARK_Mode): Handle properly
a subprogram body without previous spec.
2013-09-10 Gary Dismukes <dismukes@adacore.com>
* sem_ch4.adb: Minor typo fixes.
2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
* aspects.adb (Aspects_On_Body_OK): New routine.
* aspects.ads: Modify type Aspect_Expression to include
the Optional_XXX variants. Update the contents of
table Aspect_Argument. Add table Aspect_On_Body_OK.
(Aspects_On_Body_OK): New routine.
* par-ch13.adb (Get_Aspect_Specifications): Account for optional
names and expressions when parsing an aspect.
* sem_ch6.adb: Add with and use clause for Aspects.
(Analyze_Subprogram_Body_Helper): Do not emit an error when
analyzing a body with aspects that can be applied simultaneously
to both spec and body.
* sem_ch13.adb (Analyze_Aspect_Specifications): Insert the
corresponding pragma of an aspect that applies to a subprogram
body in the declarative part.
(Make_Aitem_Pragma): Do not generate a pragma with an empty argument
list.
From-SVN: r202462
Diffstat (limited to 'gcc/ada/aspects.adb')
-rw-r--r-- | gcc/ada/aspects.adb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 111b407..1d73646 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -140,6 +140,40 @@ package body Aspects is end if; end Aspect_Specifications; + ------------------------ + -- Aspects_On_Body_OK -- + ------------------------ + + function Aspects_On_Body_OK (N : Node_Id) return Boolean is + Aspect : Node_Id; + Aspects : List_Id; + + begin + -- The routine should be invoked on a body [stub] with aspects + + pragma Assert (Has_Aspects (N)); + pragma Assert (Nkind (N) in N_Body_Stub + or else Nkind_In (N, N_Package_Body, + N_Protected_Body, + N_Subprogram_Body, + N_Task_Body)); + + -- Look through all aspects and see whether they can be applied to a + -- body. + + Aspects := Aspect_Specifications (N); + Aspect := First (Aspects); + while Present (Aspect) loop + if not Aspect_On_Body_OK (Get_Aspect_Id (Aspect)) then + return False; + end if; + + Next (Aspect); + end loop; + + return True; + end Aspects_On_Body_OK; + ----------------- -- Find_Aspect -- ----------------- |