Commit 1c163178 by Arnaud Charlet

[multiple changes]

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.

From-SVN: r182585
parent 5ebfaacf
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> 2011-12-21 Matthew Heaney <heaney@adacore.com>
* a-crbtgk.adb (Generic_Conditional_Insert): Fixed incorrect comment. * a-crbtgk.adb (Generic_Conditional_Insert): Fixed incorrect comment.
......
...@@ -376,7 +376,7 @@ package body Ch13 is ...@@ -376,7 +376,7 @@ package body Ch13 is
-------------------------------- --------------------------------
-- ASPECT_SPECIFICATION ::= -- ASPECT_SPECIFICATION ::=
-- with ASPECT_MARK [=> ASPECT_DEFINITION] {. -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
-- ASPECT_MARK [=> ASPECT_DEFINITION] } -- ASPECT_MARK [=> ASPECT_DEFINITION] }
-- ASPECT_MARK ::= aspect_IDENTIFIER['Class] -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
...@@ -411,7 +411,7 @@ package body Ch13 is ...@@ -411,7 +411,7 @@ package body Ch13 is
Ptr := Token_Ptr; Ptr := Token_Ptr;
Scan; -- past WITH 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 -- set the flag till later, because it may turn out that we have no
-- valid aspects in the list. -- valid aspects in the list.
...@@ -547,16 +547,76 @@ package body Ch13 is ...@@ -547,16 +547,76 @@ package body Ch13 is
if Token = Tok_Comma then if Token = Tok_Comma then
Scan; -- past comma 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 elsif Token = Tok_Identifier
if Semicolon then and then Get_Aspect_Id (Token_Name) /= No_Aspect
T_Semicolon; then
end if; 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; end if;
exit;
<<Continue>>
null;
end if; end if;
end loop; end loop;
......
...@@ -884,7 +884,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is ...@@ -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 -- argument is False, the scan pointer is left pointing past the aspects
-- and the caller must check for a proper terminator. -- 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 -- either a WITH keyword starting an aspect specification, or an
-- instance of the terminator token. In the former case, the aspect -- instance of the terminator token. In the former case, the aspect
-- specifications are scanned out including the terminator token if it -- specifications are scanned out including the terminator token if it
......
...@@ -2126,10 +2126,9 @@ package body Sem_Ch13 is ...@@ -2126,10 +2126,9 @@ package body Sem_Ch13 is
end case; end case;
end if; end if;
-- Process Ignore_Rep_Clauses option (we also ignore rep clauses in -- Process Ignore_Rep_Clauses option
-- Alfa mode, since they are not relevant in this context).
if Ignore_Rep_Clauses or Alfa_Mode then if Ignore_Rep_Clauses then
case Id is case Id is
-- The following should be ignored. They do not affect legality -- The following should be ignored. They do not affect legality
...@@ -2149,11 +2148,7 @@ package body Sem_Ch13 is ...@@ -2149,11 +2148,7 @@ package body Sem_Ch13 is
Rewrite (N, Make_Null_Statement (Sloc (N))); Rewrite (N, Make_Null_Statement (Sloc (N)));
return; return;
-- We do not want too ignore 'Small in CodePeer_Mode or Alfa_Mode, -- Perhaps 'Small should not be ignored by Ignore_Rep_Clauses ???
-- since it has an impact on the exact computations performed.
-- Perhaps 'Small should also not be ignored by
-- Ignore_Rep_Clauses ???
when Attribute_Small => when Attribute_Small =>
if Ignore_Rep_Clauses then if Ignore_Rep_Clauses then
......
...@@ -9331,7 +9331,6 @@ package body Sem_Util is ...@@ -9331,7 +9331,6 @@ package body Sem_Util is
and then Nkind (Expression (Expression (N))) = N_Op_Concat and then Nkind (Expression (Expression (N))) = N_Op_Concat
then then
Set_Is_Dynamic_Coextension (N); Set_Is_Dynamic_Coextension (N);
else else
Set_Is_Static_Coextension (N); Set_Is_Static_Coextension (N);
end if; end if;
...@@ -9346,12 +9345,33 @@ package body Sem_Util is ...@@ -9346,12 +9345,33 @@ package body Sem_Util is
begin begin
case Nkind (Context_Nod) is 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; 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 => 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 -- This routine should not be called for constructs which may not
-- contain coextensions. -- contain coextensions.
...@@ -9371,9 +9391,9 @@ package body Sem_Util is ...@@ -9371,9 +9391,9 @@ package body Sem_Util is
Formal : Entity_Id; Formal : Entity_Id;
begin begin
if Ada_Version >= Ada_2005 -- Ada 2005 or later, and formals present
and then Present (First_Formal (E))
then if Ada_Version >= Ada_2005 and then Present (First_Formal (E)) then
Formal := Next_Formal (First_Formal (E)); Formal := Next_Formal (First_Formal (E));
while Present (Formal) loop while Present (Formal) loop
if No (Default_Value (Formal)) then if No (Default_Value (Formal)) then
...@@ -9385,6 +9405,8 @@ package body Sem_Util is ...@@ -9385,6 +9405,8 @@ package body Sem_Util is
return True; return True;
-- Ada 83/95 or no formals
else else
return False; return False;
end if; end if;
......
...@@ -6571,7 +6571,7 @@ package Sinfo is ...@@ -6571,7 +6571,7 @@ package Sinfo is
-- We modify the RM grammar here, the RM grammar is: -- We modify the RM grammar here, the RM grammar is:
-- ASPECT_SPECIFICATION ::= -- ASPECT_SPECIFICATION ::=
-- with ASPECT_MARK [=> ASPECT_DEFINITION] {. -- with ASPECT_MARK [=> ASPECT_DEFINITION] {,
-- ASPECT_MARK [=> ASPECT_DEFINITION] } -- ASPECT_MARK [=> ASPECT_DEFINITION] }
-- ASPECT_MARK ::= aspect_IDENTIFIER['Class] -- ASPECT_MARK ::= aspect_IDENTIFIER['Class]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment