aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch13.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-09-10 17:12:42 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-09-10 17:12:42 +0200
commit80e59506c2065fe2f4550644e0fbf2b585ab5be3 (patch)
tree039c8844fa257a96041b0dabfdfdb9b94b398349 /gcc/ada/sem_ch13.adb
parent4bb9c7b9ed2ddc21915fd41fcac2bd0b77609c7c (diff)
downloadgcc-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/sem_ch13.adb')
-rw-r--r--gcc/ada/sem_ch13.adb19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index ac9e736..37b9e9a 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1357,17 +1357,26 @@ package body Sem_Ch13 is
(Pragma_Argument_Associations : List_Id;
Pragma_Name : Name_Id)
is
+ Args : List_Id := Pragma_Argument_Associations;
+
begin
-- We should never get here if aspect was disabled
pragma Assert (not Is_Disabled (Aspect));
+ -- Certan aspects allow for an optional name or expression. Do
+ -- not generate a pragma with an empty argument association
+ -- list.
+
+ if No (Args) or else No (Expression (First (Args))) then
+ Args := No_List;
+ end if;
+
-- Build the pragma
Aitem :=
Make_Pragma (Loc,
- Pragma_Argument_Associations =>
- Pragma_Argument_Associations,
+ Pragma_Argument_Associations => Args,
Pragma_Identifier =>
Make_Identifier (Sloc (Id), Pragma_Name),
Class_Present => Class_Present (Aspect),
@@ -2433,10 +2442,10 @@ package body Sem_Ch13 is
Set_Has_Delayed_Aspects (E);
Record_Rep_Item (E, Aspect);
- -- When delay is not required and the context is a package body,
- -- insert the pragma in the declarations of the body.
+ -- When delay is not required and the context is a package or a
+ -- subprogram body, insert the pragma in the body declarations.
- elsif Nkind (N) = N_Package_Body then
+ elsif Nkind_In (N, N_Package_Body, N_Subprogram_Body) then
if No (Declarations (N)) then
Set_Declarations (N, New_List);
end if;