diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-10 15:12:42 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-10 15:12:42 +0000 |
commit | b855559d609469c4253a9173c2ad9fd4fb6f59db (patch) | |
tree | 039c8844fa257a96041b0dabfdfdb9b94b398349 /gcc/ada/aspects.adb | |
parent | 753d3808d3ba06909775c95936dc46b1343b0bac (diff) | |
download | gcc-b855559d609469c4253a9173c2ad9fd4fb6f59db.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202462 138bc75d-0d04-0410-961f-82ee72b054a4
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 111b407867b..1d736467b46 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 -- ----------------- |