aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog22
-rw-r--r--gcc/ada/par-ch13.adb76
-rw-r--r--gcc/ada/par.adb2
-rw-r--r--gcc/ada/sem_ch13.adb11
-rw-r--r--gcc/ada/sem_util.adb36
-rw-r--r--gcc/ada/sinfo.ads2
6 files changed, 124 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index dcf04f9..be29ee2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,25 @@
+2011-12-21 Yannick Moy <moy@adacore.com>
+
+ * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not
+ ignore representation attributes in Alfa mode, since formal
+ verification backend does not depend on actual physical
+ representation, but code may still refer to attribute values.
+
+2011-12-21 Yannick Moy <moy@adacore.com>
+
+ * par-ch13.adb (P_Aspect_Specifications): Recognize the cases
+ where a comma between two aspects is missing, or erroneously
+ replaced by a semicolon, issue an error and proceed with next
+ aspect.
+ * par.adb, sinfo.ads: Fix typos.
+
+2011-12-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.adb (Mark_Coextensions): A coextension for an
+ object that is part of the expression in a return statement,
+ or part of the return object in an extended return statement,
+ must be allocated dynamically.
+
2011-12-21 Matthew Heaney <heaney@adacore.com>
* a-crbtgk.adb (Generic_Conditional_Insert): Fixed incorrect comment.
diff --git a/gcc/ada/par-ch13.adb b/gcc/ada/par-ch13.adb
index ecbf58f..82e96ce 100644
--- a/gcc/ada/par-ch13.adb
+++ b/gcc/ada/par-ch13.adb
@@ -376,7 +376,7 @@ package body Ch13 is
--------------------------------
-- ASPECT_SPECIFICATION ::=
- -- with ASPECT_MARK [=> ASPECT_DEFINITION] {.
+ -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
-- ASPECT_MARK [=> ASPECT_DEFINITION] }
-- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
@@ -411,7 +411,7 @@ package body Ch13 is
Ptr := Token_Ptr;
Scan; -- past WITH
- -- Here we have an aspect specification to scan, note that we don;t
+ -- Here we have an aspect specification to scan, note that we don't
-- set the flag till later, because it may turn out that we have no
-- valid aspects in the list.
@@ -547,16 +547,76 @@ package body Ch13 is
if Token = Tok_Comma then
Scan; -- past comma
+ goto Continue;
- -- Must be terminator character
+ -- Recognize the case where a comma is missing between two
+ -- aspects, issue an error and proceed with next aspect.
- else
- if Semicolon then
- T_Semicolon;
- end if;
+ elsif Token = Tok_Identifier
+ and then Get_Aspect_Id (Token_Name) /= No_Aspect
+ then
+ declare
+ Scan_State : Saved_Scan_State;
+
+ begin
+ Save_Scan_State (Scan_State);
+ Scan; -- past identifier
+
+ if Token = Tok_Arrow then
+ Restore_Scan_State (Scan_State);
+ Error_Msg_AP -- CODEFIX
+ ("|missing "",""");
+ goto Continue;
- exit;
+ else
+ Restore_Scan_State (Scan_State);
+ end if;
+ end;
+
+ -- Recognize the case where a semicolon was mistyped for a comma
+ -- between two aspects, issue an error and proceed with next
+ -- aspect.
+
+ elsif Token = Tok_Semicolon then
+ declare
+ Scan_State : Saved_Scan_State;
+
+ begin
+ Save_Scan_State (Scan_State);
+ Scan; -- past semicolon
+
+ if Token = Tok_Identifier
+ and then Get_Aspect_Id (Token_Name) /= No_Aspect
+ then
+ Scan; -- past identifier
+
+ if Token = Tok_Arrow then
+ Restore_Scan_State (Scan_State);
+ Error_Msg_SC -- CODEFIX
+ ("|"";"" should be "",""");
+ Scan; -- past semicolon
+ goto Continue;
+
+ else
+ Restore_Scan_State (Scan_State);
+ end if;
+
+ else
+ Restore_Scan_State (Scan_State);
+ end if;
+ end;
+ end if;
+
+ -- Must be terminator character
+
+ if Semicolon then
+ T_Semicolon;
end if;
+
+ exit;
+
+ <<Continue>>
+ null;
end if;
end loop;
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index ed2e724..3f9d541 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -884,7 +884,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
-- argument is False, the scan pointer is left pointing past the aspects
-- and the caller must check for a proper terminator.
--
- -- P_Aspect_Specification is called with the current token pointing to
+ -- P_Aspect_Specifications is called with the current token pointing to
-- either a WITH keyword starting an aspect specification, or an
-- instance of the terminator token. In the former case, the aspect
-- specifications are scanned out including the terminator token if it
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 98fd99e..e6b016d 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -2126,10 +2126,9 @@ package body Sem_Ch13 is
end case;
end if;
- -- Process Ignore_Rep_Clauses option (we also ignore rep clauses in
- -- Alfa mode, since they are not relevant in this context).
+ -- Process Ignore_Rep_Clauses option
- if Ignore_Rep_Clauses or Alfa_Mode then
+ if Ignore_Rep_Clauses then
case Id is
-- The following should be ignored. They do not affect legality
@@ -2149,11 +2148,7 @@ package body Sem_Ch13 is
Rewrite (N, Make_Null_Statement (Sloc (N)));
return;
- -- We do not want too ignore 'Small in CodePeer_Mode or Alfa_Mode,
- -- since it has an impact on the exact computations performed.
-
- -- Perhaps 'Small should also not be ignored by
- -- Ignore_Rep_Clauses ???
+ -- Perhaps 'Small should not be ignored by Ignore_Rep_Clauses ???
when Attribute_Small =>
if Ignore_Rep_Clauses then
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 8c90086..1028461 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -9331,7 +9331,6 @@ package body Sem_Util is
and then Nkind (Expression (Expression (N))) = N_Op_Concat
then
Set_Is_Dynamic_Coextension (N);
-
else
Set_Is_Static_Coextension (N);
end if;
@@ -9346,12 +9345,33 @@ package body Sem_Util is
begin
case Nkind (Context_Nod) is
- when N_Assignment_Statement |
- N_Simple_Return_Statement =>
+
+ -- Comment here ???
+
+ when N_Assignment_Statement =>
Is_Dynamic := Nkind (Expression (Context_Nod)) = N_Allocator;
+ -- An allocator that is a component of a returned aggregate
+ -- must be dynamic.
+
+ when N_Simple_Return_Statement =>
+ declare
+ Expr : constant Node_Id := Expression (Context_Nod);
+ begin
+ Is_Dynamic :=
+ Nkind (Expr) = N_Allocator
+ or else
+ (Nkind (Expr) = N_Qualified_Expression
+ and then Nkind (Expression (Expr)) = N_Aggregate);
+ end;
+
+ -- An alloctor within an object declaration in an extended return
+ -- statement is of necessity dynamic.
+
when N_Object_Declaration =>
- Is_Dynamic := Nkind (Root_Nod) = N_Allocator;
+ Is_Dynamic := Nkind (Root_Nod) = N_Allocator
+ or else
+ Nkind (Parent (Context_Nod)) = N_Extended_Return_Statement;
-- This routine should not be called for constructs which may not
-- contain coextensions.
@@ -9371,9 +9391,9 @@ package body Sem_Util is
Formal : Entity_Id;
begin
- if Ada_Version >= Ada_2005
- and then Present (First_Formal (E))
- then
+ -- Ada 2005 or later, and formals present
+
+ if Ada_Version >= Ada_2005 and then Present (First_Formal (E)) then
Formal := Next_Formal (First_Formal (E));
while Present (Formal) loop
if No (Default_Value (Formal)) then
@@ -9385,6 +9405,8 @@ package body Sem_Util is
return True;
+ -- Ada 83/95 or no formals
+
else
return False;
end if;
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index be4f8dc..ce4a31c 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -6571,7 +6571,7 @@ package Sinfo is
-- We modify the RM grammar here, the RM grammar is:
-- ASPECT_SPECIFICATION ::=
- -- with ASPECT_MARK [=> ASPECT_DEFINITION] {.
+ -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
-- ASPECT_MARK [=> ASPECT_DEFINITION] }
-- ASPECT_MARK ::= aspect_IDENTIFIER['Class]