Commit 055311dd by Hristian Kirtchev Committed by Arnaud Charlet

sem_prag.adb (Analyze_Pragma): Do not output the characters of an illegal…

sem_prag.adb (Analyze_Pragma): Do not output the characters of an illegal argument as it may not have...

2012-11-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Pragma): Do not
	output the characters of an illegal argument as it may not have
	characters to begin with.

2012-11-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_prag.adb (Expand_Pragma_Loop_Assertion):
	Change the order of argument processing to avoid disappearing
	increase / decrease expressions.

From-SVN: r193212
parent 41c15e3e
2012-11-06 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Analyze_Pragma): Do not
output the characters of an illegal argument as it may not have
characters to begin with.
2012-11-06 Hristian Kirtchev <kirtchev@adacore.com>
* exp_prag.adb (Expand_Pragma_Loop_Assertion):
Change the order of argument processing to avoid disappearing
increase / decrease expressions.
2012-11-06 Hristian Kirtchev <kirtchev@adacore.com>
* exp_prag.adb: Add with and use clause for Sem_Ch8.
(Expand_N_Pragma): Add a new variant to expand pragma Loop_Assertion.
(Expand_Pragma_Loop_Assertion): New routine.
......
......@@ -1076,10 +1076,12 @@ package body Exp_Prag is
Arg := First (Args);
while Present (Arg) loop
if No (Invar) or else Chars (Arg) = Name_Invariant then
Invar := Expression (Arg);
else
if Chars (Arg) = Name_Increases
or else Chars (Arg) = Name_Decreases
then
Process_Increase_Decrease (Arg, Is_Last => Arg = Last_Arg);
else
Invar := Expression (Arg);
end if;
Next (Arg);
......@@ -1088,12 +1090,14 @@ package body Exp_Prag is
-- Verify the invariant expression, generate:
-- pragma Assert (<Invar>);
Insert_Action (N,
Make_Pragma (Loc,
Chars => Name_Assert,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Invar)))));
if Present (Invar) then
Insert_Action (N,
Make_Pragma (Loc,
Chars => Name_Assert,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Invar)))));
end if;
-- Construct the segment which stores the old values of all expressions.
-- Generate:
......
......@@ -11335,8 +11335,12 @@ package body Sem_Prag is
-- relocated during expansion and analyzed in their new
-- context.
if Chars (Arg) = Name_Invariant or else Arg_Count = 1 then
if Chars (Arg) = Name_Invariant
or else
(Arg_Count = 1
and then Chars (Arg) /= Name_Increases
and then Chars (Arg) /= Name_Decreases)
then
-- Only one invariant is allowed in the pragma
if Seen then
......@@ -11355,7 +11359,7 @@ package body Sem_Prag is
-- Illegal argument
else
Error_Pragma_Arg ("argument & not allowed in pragma %", Arg);
Error_Pragma_Arg ("argument not allowed in pragma %", Arg);
end if;
Next (Arg);
......
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