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.
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);
-- 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:
-- 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
-- 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);