From 08988ed947922e00ee6d0c0ecb9a6de01cdc7238 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 10 Oct 2013 15:17:07 +0200 Subject: [multiple changes] 2013-10-10 Robert Dewar * par-ch6.adb (Check_Junk_Semicolon_Before_Return): Remove junk code. 2013-10-10 Javier Miranda * sem_ch13.adb (Freeze_Entity_Checks): Avoid loosing errors on CPP entities in -gnatc mode. 2013-10-10 Robert Dewar * sem_ch5.adb (Analyze_If_Statement): Only diagnose redundant if from source. 2013-10-10 Robert Dewar * restrict.adb (Check_SPARK_Restriction): Refine test (don't automatically go to the original node). * sem_ch11.adb (Analyze_Raise_Statement): Only raise statements that come from source violate SPARK restrictions. (Analyze_Raise_xxx_Error): Same fix. * sem_ch3.adb (Analyze_Object_Declaration): Check OK SPARK initialization on original node, not on possibly rewritten expression. * sem_ch4.adb (Analyze_If_Expression): Only if expressions that come from source violate SPARK mode restrictions. 2013-10-10 Robert Dewar * gnat_ugn.texi: Fix confusing documentation for -gnatyM. From-SVN: r203374 --- gcc/ada/restrict.adb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'gcc/ada/restrict.adb') diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index ea0f89c..668c444 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -1406,9 +1406,30 @@ package body Restrict is is Msg_Issued : Boolean; Save_Error_Msg_Sloc : Source_Ptr; + Onode : constant Node_Id := Original_Node (N); begin - if Force or else Comes_From_Source (Original_Node (N)) then + -- Output message if Force set + + if Force + + -- Or if this node comes from source + + or else Comes_From_Source (N) + + -- Or if this is a range node which rewrites a range attribute and + -- the range attribute comes from source. + + or else (Nkind (N) = N_Range + and then Nkind (Onode) = N_Attribute_Reference + and then Attribute_Name (Onode) = Name_Range + and then Comes_From_Source (Onode)) + + -- Or this is an expression that does not come from source, which is + -- a rewriting of an expression that does come from source. + + or else (Nkind (N) in N_Subexpr and then Comes_From_Source (Onode)) + then if Restriction_Check_Required (SPARK_05) and then Is_In_Hidden_Part_In_SPARK (Sloc (N)) then -- cgit v1.1