Commit 738b83cd by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Set Current_Error_Node directly

This changes gigi to set Current_Error_Node directly, which should
result in a more robust error handling.

2018-09-26  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* gcc-interface/gigi.h (error_gnat_node): Delete.
	* gcc-interface/trans.c (error_gnat_node): Likewise.
	(gigi): Replace it with Current_Error_Node.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils.c (rest_of_subprog_body_compilation):
	Likewise.
	* gcc-interface/misc.c (internal_error_function): Do not set it.

From-SVN: r264607
parent 3b9d1594
2018-09-26 Eric Botcazou <ebotcazou@adacore.com> 2018-09-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (error_gnat_node): Delete.
* gcc-interface/trans.c (error_gnat_node): Likewise.
(gigi): Replace it with Current_Error_Node.
(gnat_to_gnu): Likewise.
* gcc-interface/utils.c (rest_of_subprog_body_compilation):
Likewise.
* gcc-interface/misc.c (internal_error_function): Do not set it.
2018-09-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Adjust * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Adjust
code retrieving the address when a clause has already been code retrieving the address when a clause has already been
processed. processed.
......
...@@ -214,9 +214,6 @@ extern void destroy_gnat_decl (void); ...@@ -214,9 +214,6 @@ extern void destroy_gnat_decl (void);
/* Highest number in the front-end node table. */ /* Highest number in the front-end node table. */
extern int max_gnat_nodes; extern int max_gnat_nodes;
/* Current node being treated, in case abort called. */
extern Node_Id error_gnat_node;
/* True when gigi is being called on an analyzed but unexpanded /* True when gigi is being called on an analyzed but unexpanded
tree, and the only purpose of the call is to properly annotate tree, and the only purpose of the call is to properly annotate
types with representation information. */ types with representation information. */
......
...@@ -347,7 +347,6 @@ internal_error_function (diagnostic_context *context, const char *msgid, ...@@ -347,7 +347,6 @@ internal_error_function (diagnostic_context *context, const char *msgid,
sp_loc.Bounds = &temp_loc; sp_loc.Bounds = &temp_loc;
sp_loc.Array = loc; sp_loc.Array = loc;
Current_Error_Node = error_gnat_node;
Compiler_Abort (sp, sp_loc, true); Compiler_Abort (sp, sp_loc, true);
} }
......
...@@ -86,9 +86,6 @@ struct List_Header *List_Headers_Ptr; ...@@ -86,9 +86,6 @@ struct List_Header *List_Headers_Ptr;
/* Highest number in the front-end node table. */ /* Highest number in the front-end node table. */
int max_gnat_nodes; int max_gnat_nodes;
/* Current node being treated, in case abort called. */
Node_Id error_gnat_node;
/* True when gigi is being called on an analyzed but unexpanded /* True when gigi is being called on an analyzed but unexpanded
tree, and the only purpose of the call is to properly annotate tree, and the only purpose of the call is to properly annotate
types with representation information. */ types with representation information. */
...@@ -719,7 +716,7 @@ gigi (Node_Id gnat_root, ...@@ -719,7 +716,7 @@ gigi (Node_Id gnat_root,
destroy_gnat_utils (); destroy_gnat_utils ();
/* We cannot track the location of errors past this point. */ /* We cannot track the location of errors past this point. */
error_gnat_node = Empty; Current_Error_Node = Empty;
} }
/* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given /* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given
...@@ -5910,7 +5907,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -5910,7 +5907,7 @@ gnat_to_gnu (Node_Id gnat_node)
bool sync = false; bool sync = false;
/* Save node number for error message and set location information. */ /* Save node number for error message and set location information. */
error_gnat_node = gnat_node; Current_Error_Node = gnat_node;
Sloc_to_locus (Sloc (gnat_node), &input_location); Sloc_to_locus (Sloc (gnat_node), &input_location);
/* If we are only annotating types and this node is a statement, return /* If we are only annotating types and this node is a statement, return
......
...@@ -3389,7 +3389,7 @@ void ...@@ -3389,7 +3389,7 @@ void
rest_of_subprog_body_compilation (tree subprog_decl) rest_of_subprog_body_compilation (tree subprog_decl)
{ {
/* We cannot track the location of errors past this point. */ /* We cannot track the location of errors past this point. */
error_gnat_node = Empty; Current_Error_Node = Empty;
/* If we're only annotating types, don't actually compile this function. */ /* If we're only annotating types, don't actually compile this function. */
if (type_annotate_only) if (type_annotate_only)
......
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