mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			[multiple changes]
2014-06-13 Hristian Kirtchev <kirtchev@adacore.com> * errout.adb (SPARK_Msg_N): New routine. (SPARK_Msg_NE): New routine. * errout.ads Add a section on SPARK-related error routines. (SPARK_Msg_N): New routine. (SPARK_Msg_NE): New routine. * sem_ch13.adb (Analyze_Aspect_Specifications): Ensure that pragma Abstract_State is always inserted after SPARK_Mode. (Insert_After_SPARK_Mode): New routine. * sem_prag.adb (Analyze_Abstract_State, Analyze_Constituent, Analyze_External_Property, Analyze_External_Property_In_Decl_Part, Analyze_Global_Item, Analyze_Global_List, Analyze_Initialization_Item, Analyze_Initialization_Item_With_Inputs, Analyze_Input_Item, Analyze_Input_List, Analyze_Input_Output, Analyze_Part_Of, Analyze_Pragma, Analyze_Refined_Depends_In_Decl_Part, Analyze_Refined_Global_In_Decl_Part, Analyze_Refined_State_In_Decl_Part, Analyze_Refinement_Clause, Check_Aspect_Specification_Order, Check_Constituent_Usage, Check_Declaration_Order, Check_Dependency_Clause, Check_Duplicate_Mode, Check_Duplicate_Option, Check_Duplicate_Property, Check_External_Properties, Check_External_Property, Check_Function_Return, Check_Matching_Constituent, Check_Matching_State, Check_Mode_Restriction_In_Enclosing_Context, Check_Mode_Restriction_In_Function, Check_Refined_Global_Item, Check_State_And_Constituent_Use, Create_Or_Modify_Clause, Has_Extra_Parentheses, Inconsistent_Mode_Error, Match_Error, Propagate_Part_Of, Report_Extra_Clauses, Report_Extra_Constituents_In_List, Report_Extra_Inputs, Report_Unrefined_States, Report_Unused_Constituents, Report_Unused_States, Role_Error, Usage_Error): Convert Error_Msg_XXX calls to SPARK_Msg_XXX calls to report semantic errors only when SPARK_Mode is on. (Analyze_Depends_In_Decl_Part): Do not check the syntax of pragma Depends explicitly, this is now done by the analysis. (Analyze_Global_In_Decl_List): Do not check the syntax of pragma Global explicitly, this is now done by the analysis. (Analyze_Initializes_In_Decl_Part): Do not check the syntax of pragma Initializes explicitly, this is now done by the analysis. (Analyze_Part_Of): Do not check the syntax of the encapsulating state, this is now done by the analysis. (Analyze_Pragma): Do not check the syntax of a state declaration, this is now done by the analysis. (Analyze_Refined_Depends_In_Decl_Part): Do not check the syntax of pragma Refined_Depends explicitly, this is now done by the analysis. (Analyze_Refined_Global_In_Decl_Part): Do not check the syntax of pragma Refined_Global explicitly, this is now done by the analysis. (Analyze_Refined_State_In_Decl_Part): Do not check the syntax of pragma Refined_State explicitly, this is now done by the analysis. (Check_Dependence_List_Syntax): Removed. (Check_Global_List_Syntax): Removed. (Check_Initialization_List_Syntax): Removed. (Check_Item_Syntax): Removed. (Check_Missing_Part_Of): Do not consider items from an instance. (Check_Refinement_List_Syntax): Removed. (Check_State_Declaration_Syntax): Removed. (Collect_Global_List): Do not raise Program_Error when the input is malformed. (Process_Global_List): Do not raise Program_Error when the input is malformed. * sem_ch13.adb: Minor reformatting. 2014-06-13 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Find_Type_Name): Diagnose a private type completion that is an interface definition with an interface list. (Process_Full_View): Move error message on missmatched interfaces between views to the declaration of full view, for clarity. * sem_ch9.adb (Check_Interfaces): Move error message to full view, for clarity. From-SVN: r211626
This commit is contained in:
		
							parent
							
								
									6aa4c5b68d
								
							
						
					
					
						commit
						d2adb45e35
					
				|  | @ -1,3 +1,79 @@ | ||||||
|  | 2014-06-13  Hristian Kirtchev  <kirtchev@adacore.com> | ||||||
|  | 
 | ||||||
|  | 	* errout.adb (SPARK_Msg_N): New routine. | ||||||
|  | 	(SPARK_Msg_NE): New routine. | ||||||
|  | 	* errout.ads Add a section on SPARK-related error routines. | ||||||
|  | 	(SPARK_Msg_N): New routine. | ||||||
|  | 	(SPARK_Msg_NE): New routine. | ||||||
|  | 	* sem_ch13.adb (Analyze_Aspect_Specifications): Ensure that | ||||||
|  | 	pragma Abstract_State is always inserted after SPARK_Mode. | ||||||
|  | 	(Insert_After_SPARK_Mode): New routine. | ||||||
|  | 	* sem_prag.adb (Analyze_Abstract_State, | ||||||
|  | 	Analyze_Constituent, Analyze_External_Property, | ||||||
|  | 	Analyze_External_Property_In_Decl_Part, Analyze_Global_Item, | ||||||
|  | 	Analyze_Global_List, Analyze_Initialization_Item, | ||||||
|  | 	Analyze_Initialization_Item_With_Inputs, Analyze_Input_Item, | ||||||
|  | 	Analyze_Input_List, Analyze_Input_Output, Analyze_Part_Of, | ||||||
|  | 	Analyze_Pragma, Analyze_Refined_Depends_In_Decl_Part, | ||||||
|  | 	Analyze_Refined_Global_In_Decl_Part, | ||||||
|  | 	Analyze_Refined_State_In_Decl_Part, Analyze_Refinement_Clause, | ||||||
|  | 	Check_Aspect_Specification_Order, Check_Constituent_Usage, | ||||||
|  | 	Check_Declaration_Order, Check_Dependency_Clause, | ||||||
|  | 	Check_Duplicate_Mode, Check_Duplicate_Option, | ||||||
|  | 	Check_Duplicate_Property, Check_External_Properties, | ||||||
|  | 	Check_External_Property, Check_Function_Return, | ||||||
|  | 	Check_Matching_Constituent, Check_Matching_State, | ||||||
|  | 	Check_Mode_Restriction_In_Enclosing_Context, | ||||||
|  | 	Check_Mode_Restriction_In_Function, Check_Refined_Global_Item, | ||||||
|  | 	Check_State_And_Constituent_Use, Create_Or_Modify_Clause, | ||||||
|  | 	Has_Extra_Parentheses, Inconsistent_Mode_Error, | ||||||
|  | 	Match_Error, Propagate_Part_Of, Report_Extra_Clauses, | ||||||
|  | 	Report_Extra_Constituents_In_List, Report_Extra_Inputs, | ||||||
|  | 	Report_Unrefined_States, Report_Unused_Constituents, | ||||||
|  | 	Report_Unused_States, Role_Error, Usage_Error): | ||||||
|  | 	Convert Error_Msg_XXX calls to SPARK_Msg_XXX calls | ||||||
|  | 	to report semantic errors only when SPARK_Mode is on. | ||||||
|  | 	(Analyze_Depends_In_Decl_Part): Do not check the syntax of | ||||||
|  | 	pragma Depends explicitly, this is now done by the analysis. | ||||||
|  | 	(Analyze_Global_In_Decl_List): Do not check the syntax of | ||||||
|  | 	pragma Global explicitly, this is now done by the analysis. | ||||||
|  | 	(Analyze_Initializes_In_Decl_Part): Do not check the syntax of | ||||||
|  | 	pragma Initializes explicitly, this is now done by the analysis. | ||||||
|  | 	(Analyze_Part_Of): Do not check the syntax of the encapsulating | ||||||
|  | 	state, this is now done by the analysis. | ||||||
|  | 	(Analyze_Pragma): Do | ||||||
|  | 	not check the syntax of a state declaration, this is now done | ||||||
|  | 	by the analysis. | ||||||
|  | 	(Analyze_Refined_Depends_In_Decl_Part): Do not | ||||||
|  | 	check the syntax of pragma Refined_Depends explicitly, this is now | ||||||
|  | 	done by the analysis. | ||||||
|  | 	(Analyze_Refined_Global_In_Decl_Part): Do | ||||||
|  | 	not check the syntax of pragma Refined_Global explicitly, this is | ||||||
|  | 	now done by the analysis. | ||||||
|  | 	(Analyze_Refined_State_In_Decl_Part): | ||||||
|  | 	Do not check the syntax of pragma Refined_State explicitly, this | ||||||
|  | 	is now done by the analysis. | ||||||
|  | 	(Check_Dependence_List_Syntax): Removed. | ||||||
|  | 	(Check_Global_List_Syntax): Removed. | ||||||
|  | 	(Check_Initialization_List_Syntax): Removed. | ||||||
|  | 	(Check_Item_Syntax): Removed. | ||||||
|  | 	(Check_Missing_Part_Of): Do not consider items from an instance. | ||||||
|  | 	(Check_Refinement_List_Syntax): Removed. | ||||||
|  | 	(Check_State_Declaration_Syntax): Removed. | ||||||
|  | 	(Collect_Global_List): Do not raise Program_Error when the input is | ||||||
|  | 	malformed. | ||||||
|  | 	(Process_Global_List): Do not raise Program_Error when the input | ||||||
|  | 	is malformed. | ||||||
|  | 	* sem_ch13.adb: Minor reformatting. | ||||||
|  | 2014-06-13  Ed Schonberg  <schonberg@adacore.com> | ||||||
|  | 
 | ||||||
|  | 	* sem_ch3.adb (Find_Type_Name): Diagnose a private type completion | ||||||
|  | 	that is an interface definition with an interface list. | ||||||
|  | 	(Process_Full_View): Move error message on missmatched interfaces | ||||||
|  | 	between views to the declaration of full view, for clarity. | ||||||
|  | 	* sem_ch9.adb (Check_Interfaces): Move error message to full view, | ||||||
|  | 	for clarity. | ||||||
|  | 
 | ||||||
| 2014-06-13  Robert Dewar  <dewar@adacore.com> | 2014-06-13  Robert Dewar  <dewar@adacore.com> | ||||||
| 
 | 
 | ||||||
| 	* exp_attr.adb (Expand_N_Attribute_Reference, case Pred/Succ): Change | 	* exp_attr.adb (Expand_N_Attribute_Reference, case Pred/Succ): Change | ||||||
|  |  | ||||||
|  | @ -3065,6 +3065,32 @@ package body Errout is | ||||||
|       return False; |       return False; | ||||||
|    end Special_Msg_Delete; |    end Special_Msg_Delete; | ||||||
| 
 | 
 | ||||||
|  |    ----------------- | ||||||
|  |    -- SPARK_Msg_N -- | ||||||
|  |    ----------------- | ||||||
|  | 
 | ||||||
|  |    procedure SPARK_Msg_N (Msg : String; N : Node_Or_Entity_Id) is | ||||||
|  |    begin | ||||||
|  |       if SPARK_Mode = On then | ||||||
|  |          Error_Msg_N (Msg, N); | ||||||
|  |       end if; | ||||||
|  |    end SPARK_Msg_N; | ||||||
|  | 
 | ||||||
|  |    ------------------ | ||||||
|  |    -- SPARK_Msg_NE -- | ||||||
|  |    ------------------ | ||||||
|  | 
 | ||||||
|  |    procedure SPARK_Msg_NE | ||||||
|  |      (Msg : String; | ||||||
|  |       N   : Node_Or_Entity_Id; | ||||||
|  |       E   : Node_Or_Entity_Id) | ||||||
|  |    is | ||||||
|  |    begin | ||||||
|  |       if SPARK_Mode = On then | ||||||
|  |          Error_Msg_NE (Msg, N, E); | ||||||
|  |       end if; | ||||||
|  |    end SPARK_Msg_NE; | ||||||
|  | 
 | ||||||
|    -------------------------- |    -------------------------- | ||||||
|    -- Unwind_Internal_Type -- |    -- Unwind_Internal_Type -- | ||||||
|    -------------------------- |    -------------------------- | ||||||
|  |  | ||||||
|  | @ -908,6 +908,29 @@ package Errout is | ||||||
|    procedure dmsg (Id : Error_Msg_Id) renames Erroutc.dmsg; |    procedure dmsg (Id : Error_Msg_Id) renames Erroutc.dmsg; | ||||||
|    --  Debugging routine to dump an error message |    --  Debugging routine to dump an error message | ||||||
| 
 | 
 | ||||||
|  |    ------------------------------------ | ||||||
|  |    -- SPARK Error Output Subprograms -- | ||||||
|  |    ------------------------------------ | ||||||
|  | 
 | ||||||
|  |    --  The following routines are intended to report semantic errors in SPARK | ||||||
|  |    --  constructs subject to aspect/pragma SPARK_Mode. Note that syntax errors | ||||||
|  |    --  must be reported using the Error_Msg_XXX routines. This allows for the | ||||||
|  |    --  partial analysis of SPARK features when they are disabled via SPARK_Mode | ||||||
|  |    --  set to "off". | ||||||
|  | 
 | ||||||
|  |    procedure SPARK_Msg_N (Msg : String; N : Node_Or_Entity_Id); | ||||||
|  |    pragma Inline (SPARK_Msg_N); | ||||||
|  |    --  Same as Error_Msg_N, but the error is reported only when SPARK_Mode is | ||||||
|  |    --  "on". The routine is inlined because it acts as a simple wrapper. | ||||||
|  | 
 | ||||||
|  |    procedure SPARK_Msg_NE | ||||||
|  |      (Msg : String; | ||||||
|  |       N   : Node_Or_Entity_Id; | ||||||
|  |       E   : Node_Or_Entity_Id); | ||||||
|  |    pragma Inline (SPARK_Msg_NE); | ||||||
|  |    --  Same as Error_Msg_NE, but the error is reported only when SPARK_Mode is | ||||||
|  |    --  "on". The routine is inlined because it acts as a simple wrapper. | ||||||
|  | 
 | ||||||
|    ------------------------------------ |    ------------------------------------ | ||||||
|    -- Utility Interface for Back End -- |    -- Utility Interface for Back End -- | ||||||
|    ------------------------------------ |    ------------------------------------ | ||||||
|  |  | ||||||
|  | @ -2007,10 +2007,51 @@ package body Sem_Ch13 is | ||||||
|                --  immediately. |                --  immediately. | ||||||
| 
 | 
 | ||||||
|                when Aspect_Abstract_State => Abstract_State : declare |                when Aspect_Abstract_State => Abstract_State : declare | ||||||
|  |                   procedure Insert_After_SPARK_Mode | ||||||
|  |                     (Ins_Nod : Node_Id; | ||||||
|  |                      Decls   : List_Id); | ||||||
|  |                   --  Insert Aitem before node Ins_Nod. If Ins_Nod denotes | ||||||
|  |                   --  pragma SPARK_Mode, then SPARK_Mode is skipped. Decls is | ||||||
|  |                   --  the associated declarative list where Aitem is to reside. | ||||||
|  | 
 | ||||||
|  |                   ----------------------------- | ||||||
|  |                   -- Insert_After_SPARK_Mode -- | ||||||
|  |                   ----------------------------- | ||||||
|  | 
 | ||||||
|  |                   procedure Insert_After_SPARK_Mode | ||||||
|  |                     (Ins_Nod : Node_Id; | ||||||
|  |                      Decls   : List_Id) | ||||||
|  |                   is | ||||||
|  |                      Decl : Node_Id := Ins_Nod; | ||||||
|  | 
 | ||||||
|  |                   begin | ||||||
|  |                      --  Skip SPARK_Mode | ||||||
|  | 
 | ||||||
|  |                      if Present (Decl) | ||||||
|  |                        and then Nkind (Decl) = N_Pragma | ||||||
|  |                        and then Pragma_Name (Decl) = Name_SPARK_Mode | ||||||
|  |                      then | ||||||
|  |                         Decl := Next (Decl); | ||||||
|  |                      end if; | ||||||
|  | 
 | ||||||
|  |                      if Present (Decl) then | ||||||
|  |                         Insert_Before (Decl, Aitem); | ||||||
|  | 
 | ||||||
|  |                      --  Aitem acts as the last declaration | ||||||
|  | 
 | ||||||
|  |                      else | ||||||
|  |                         Append_To (Decls, Aitem); | ||||||
|  |                      end if; | ||||||
|  |                   end Insert_After_SPARK_Mode; | ||||||
|  | 
 | ||||||
|  |                   --  Local variables | ||||||
|  | 
 | ||||||
|                   Context : Node_Id := N; |                   Context : Node_Id := N; | ||||||
|                   Decl    : Node_Id; |                   Decl    : Node_Id; | ||||||
|                   Decls   : List_Id; |                   Decls   : List_Id; | ||||||
| 
 | 
 | ||||||
|  |                --  Start of processing for Abstract_State | ||||||
|  | 
 | ||||||
|                begin |                begin | ||||||
|                   --  When aspect Abstract_State appears on a generic package, |                   --  When aspect Abstract_State appears on a generic package, | ||||||
|                   --  it is propageted to the package instance. The context in |                   --  it is propageted to the package instance. The context in | ||||||
|  | @ -2061,17 +2102,20 @@ package body Sem_Ch13 is | ||||||
|                               Decl := Next (Decl); |                               Decl := Next (Decl); | ||||||
|                            end loop; |                            end loop; | ||||||
| 
 | 
 | ||||||
|                            if Present (Decl) then |                            --  Pragma Abstract_State must be inserted after | ||||||
|                               Insert_Before (Decl, Aitem); |                            --  pragma SPARK_Mode in the tree. This ensures that | ||||||
|                            else |                            --  any error messages dependent on SPARK_Mode will | ||||||
|                               Append_To (Decls, Aitem); |                            --  be properly enabled/suppressed. | ||||||
|                            end if; | 
 | ||||||
|  |                            Insert_After_SPARK_Mode (Decl, Decls); | ||||||
| 
 | 
 | ||||||
|                         --  The related package is not a generic instance, the |                         --  The related package is not a generic instance, the | ||||||
|                         --  corresponding pragma must be the first declaration. |                         --  corresponding pragma must be the first declaration | ||||||
|  |                         --  except when SPARK_Mode is already in the list. In | ||||||
|  |                         --  that case pragma Abstract_State is placed second. | ||||||
| 
 | 
 | ||||||
|                         else |                         else | ||||||
|                            Prepend_To (Decls, Aitem); |                            Insert_After_SPARK_Mode (First (Decls), Decls); | ||||||
|                         end if; |                         end if; | ||||||
| 
 | 
 | ||||||
|                      --  Otherwise the pragma forms a new declarative list |                      --  Otherwise the pragma forms a new declarative list | ||||||
|  |  | ||||||
|  | @ -15599,8 +15599,10 @@ package body Sem_Ch3 is | ||||||
| 
 | 
 | ||||||
|                elsif Nkind (N) = N_Full_Type_Declaration |                elsif Nkind (N) = N_Full_Type_Declaration | ||||||
|                  and then |                  and then | ||||||
|                    Nkind (Type_Definition (N)) = N_Record_Definition |                    (Nkind (Type_Definition (N)) = N_Record_Definition | ||||||
|                  and then Interface_Present (Type_Definition (N)) |                      or else Nkind (Type_Definition (N)) | ||||||
|  |                                  = N_Derived_Type_Definition) | ||||||
|  |                       and then Interface_Present (Type_Definition (N)) | ||||||
|                then |                then | ||||||
|                   Error_Msg_N |                   Error_Msg_N | ||||||
|                     ("completion of private type cannot be an interface", N); |                     ("completion of private type cannot be an interface", N); | ||||||
|  | @ -18307,8 +18309,8 @@ package body Sem_Ch3 is | ||||||
| 
 | 
 | ||||||
|             if Present (Iface) then |             if Present (Iface) then | ||||||
|                Error_Msg_NE |                Error_Msg_NE | ||||||
|                  ("interface & not implemented by full type " & |                  ("interface in partial view& not implemented by full type " & | ||||||
|                   "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); |                   "(RM-2005 7.3 (7.3/2))", Full_T, Iface); | ||||||
|             end if; |             end if; | ||||||
| 
 | 
 | ||||||
|             Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); |             Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); | ||||||
|  |  | ||||||
|  | @ -3327,8 +3327,8 @@ package body Sem_Ch9 is | ||||||
| 
 | 
 | ||||||
|                if Present (Iface) then |                if Present (Iface) then | ||||||
|                   Error_Msg_NE |                   Error_Msg_NE | ||||||
|                     ("interface & not implemented by full type " & |                     ("interface in partial view& not implemented by full " | ||||||
|                      "(RM-2005 7.3 (7.3/2))", Priv_T, Iface); |                       & "type (RM-2005 7.3 (7.3/2))", T, Iface); | ||||||
|                end if; |                end if; | ||||||
| 
 | 
 | ||||||
|                Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); |                Iface := Find_Hidden_Interface (Full_T_Ifaces, Priv_T_Ifaces); | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	 Arnaud Charlet
						Arnaud Charlet