From 055311ddefe5674b074075c3720e23693370f062 Mon Sep 17 00:00:00 2001 From: Hristian Kirtchev Date: Tue, 6 Nov 2012 09:38:48 +0000 Subject: [PATCH] sem_prag.adb (Analyze_Pragma): Do not output the characters of an illegal argument as it may not have... 2012-11-06 Hristian Kirtchev * 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 * exp_prag.adb (Expand_Pragma_Loop_Assertion): Change the order of argument processing to avoid disappearing increase / decrease expressions. From-SVN: r193212 --- gcc/ada/ChangeLog | 12 ++++++++++++ gcc/ada/exp_prag.adb | 22 +++++++++++++--------- gcc/ada/sem_prag.adb | 10 +++++++--- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index bf1db35..a07bc70 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,17 @@ 2012-11-06 Hristian Kirtchev + * 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 + + * exp_prag.adb (Expand_Pragma_Loop_Assertion): + Change the order of argument processing to avoid disappearing + increase / decrease expressions. + +2012-11-06 Hristian Kirtchev + * 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. diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index e7b16a9..ae743c3 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -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 (); - 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: diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 2d66057..c2392cb 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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); -- 2.7.4