Diagnostic.c: Move the private pointer internal_error_function to diagnostic_context

Gabriel Dos Reis gdr@codesourcery.com
Sun Jun 2 12:15:00 GMT 2002


This patchlet moves the pointer internal_error_function (from
diagnostic.c) to the structure diagnostic_context.

Bootstrapped and tested oon an i686-pc-linux-gnu.

-- Gaby

2002-06-02  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.h (struct diagnostic_context):  Add new member
	internal_error. 
	(internal_error_function): Remove declaration.
	* diagnostic.c (internal_error_function): Remove definition..
	(internal_error): Adjust use.

ada/

2002-06-02  Gabriel Dos Reis  <gdr@codesourcery.com>

	* misc.c (gnat_init): Adjust setting of internal_error_function.

Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.h,v
retrieving revision 1.40
diff -p -r1.40 diagnostic.h
*** diagnostic.h	14 Apr 2002 23:35:32 -0000	1.40
--- diagnostic.h	2 Jun 2002 19:05:00 -0000
*************** struct diagnostic_context
*** 203,208 ****
--- 203,211 ----
    /* This function is called after the diagnostic message is printed.  */
    void (*end_diagnostic) PARAMS ((output_buffer *, diagnostic_context *));
  
+   /* Client hook to report an internal error.  */
+   void (*internal_error) PARAMS ((const char *, va_list *));
+ 
    /* Hook for front-end extensions.  */
    void *x_data;
  };
*************** extern diagnostic_context *global_dc;
*** 275,283 ****
  extern void set_diagnostic_context	PARAMS ((diagnostic_context *,
  						 const char *, va_list *,
  						 const char *, int, int));
- extern void set_internal_error_function	PARAMS ((void (*)
- 						 PARAMS ((const char *,
- 							  va_list *))));
  extern void report_diagnostic		PARAMS ((diagnostic_context *));
  extern void diagnostic_initialize	PARAMS ((diagnostic_context *));
  extern void init_output_buffer		PARAMS ((output_buffer *,
--- 278,283 ----
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.84
diff -p -r1.84 diagnostic.c
*** diagnostic.c	2 Jun 2002 17:36:29 -0000	1.84
--- diagnostic.c	2 Jun 2002 19:05:00 -0000
*************** fatal_error VPARAMS ((const char *msgid,
*** 1236,1255 ****
    exit (FATAL_EXIT_CODE);
  }
  
- /* Report a compiler error at the current line number.  Allow a front end to
-    intercept the message.  */
- 
- static void (*internal_error_function) PARAMS ((const char *, va_list *));
- 
- /* Set the function to call when a compiler error occurs.  */
- 
- void
- set_internal_error_function (f)
-      void (*f) PARAMS ((const char *, va_list *));
- {
-   internal_error_function = f;
- }
- 
  void
  internal_error VPARAMS ((const char *msgid, ...))
  {
--- 1236,1241 ----
*************** internal_error VPARAMS ((const char *msg
*** 1270,1277 ****
      }
  #endif
  
!   if (internal_error_function != 0)
!     (*internal_error_function) (_(msgid), &ap);
  
    set_diagnostic_context
      (&dc, msgid, &ap, input_filename, lineno, /* warn = */0);
--- 1256,1263 ----
      }
  #endif
  
!   if (global_dc->internal_error != 0)
!     (*global_dc->internal_error) (_(msgid), &ap);
  
    set_diagnostic_context
      (&dc, msgid, &ap, input_filename, lineno, /* warn = */0);
Index: ada/misc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ada/misc.c,v
retrieving revision 1.37
diff -p -r1.37 misc.c
*** ada/misc.c	25 Apr 2002 06:24:28 -0000	1.37
--- ada/misc.c	2 Jun 2002 19:05:02 -0000
*************** gnat_init (filename)
*** 384,390 ****
    gnat_argc++;
    gnat_argv[gnat_argc] = 0;
  
!   set_internal_error_function (internal_error_function);
  
    /* Show that REFERENCE_TYPEs are internal and should be Pmode.  */
    internal_reference_types ();
--- 384,390 ----
    gnat_argc++;
    gnat_argv[gnat_argc] = 0;
  
!   global_dc->internal_error = &internal_error_function;
  
    /* Show that REFERENCE_TYPEs are internal and should be Pmode.  */
    internal_reference_types ();



More information about the Gcc-patches mailing list