This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH to diagnostics



This patch fixes the testsuite failure of g++.pt/infinite1.C
introduced by my ealier changed to the G++ front-end diagnostic
machinery. 

It remains

FAIL: g++.ext/instantiate1.C not instantiated (test for errors, line 18)
FAIL: g++.ext/instantiate1.C not instantiated (test for errors, line 20)
FAIL: g++.other/loop2.C caused compiler crash


Geoff Keating told me the first two are old stories.  I believe the
third to be related to back-end changes in exception handling -- I'll
post more material on that topic later.

Bootstrapped and tested on i686-pc-linux.  Installed.

-- Gaby
CodeSourcery, LLC		http://www.codesourcery.com

2000-08-24  Gabriel Dos Reis  <gdr@codesourcery.com>

	* diagnostic.c (finish_diagnostic): Define.
	(output_do_printf): Use wrap_text instead of output_add_string.
	(default_print_error_function): Avoid embedded '\n'.

	* diagnostic.h (flush_diagnostic_buffer): Declare.

cp/
2000-08-24  Gabriel Dos Reis  <gdr@codesourcery.com>

	* error.c (print_instantiation_context): Don't forget to flush the
	buffer.

Index: diagnostic.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.h,v
retrieving revision 1.13
diff -p -r1.13 diagnostic.h
*** diagnostic.h	2000/08/22 20:20:32	1.13
--- diagnostic.h	2000/08/24 07:33:30
*************** void initialize_diagnostics     PARAMS (
*** 168,173 ****
--- 168,174 ----
  void reshape_diagnostic_buffer  PARAMS ((void));
  void default_initialize_buffer  PARAMS ((output_buffer *));
  void init_output_buffer		PARAMS ((output_buffer *, const char *, int));
+ void flush_diagnostic_buffer    PARAMS ((void));
  void output_clear		PARAMS ((output_buffer *));
  const char *output_get_prefix	PARAMS ((const output_buffer *));
  void output_set_prefix		PARAMS ((output_buffer *, const char *));
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.33
diff -p -r1.33 diagnostic.c
*** diagnostic.c	2000/08/22 20:20:32	1.33
--- diagnostic.c	2000/08/24 07:33:30
*************** output_finish (buffer)
*** 362,367 ****
--- 362,374 ----
    return (const char *) obstack_finish (&buffer->obstack);
  }
  
+ void
+ flush_diagnostic_buffer ()
+ {
+   output_to_stream (diagnostic_buffer, stderr);
+   fflush (stderr);
+ }
+ 
  /* Return the amount of characters BUFFER can accept to
     make a full line.  */
  
*************** output_do_printf (buffer, msgid)
*** 823,829 ****
    char *message = vbuild_message_string (msgid,
                                           output_buffer_format_args (buffer));
  
!   output_add_string (buffer, message);
    free (message);
  }
  
--- 830,836 ----
    char *message = vbuild_message_string (msgid,
                                           output_buffer_format_args (buffer));
  
!   wrap_text (buffer, message, message + strlen (message));
    free (message);
  }
  
*************** default_print_error_function (file)
*** 1214,1234 ****
        output_set_prefix (diagnostic_buffer, prefix);
        
        if (current_function_decl == NULL)
-         {
            output_add_string (diagnostic_buffer, "At top level:");
-           output_add_newline (diagnostic_buffer);
-         }
        else
  	{
  	  if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
              output_printf
!               (diagnostic_buffer, "In method `%s':\n",
                 (*decl_printable_name) (current_function_decl, 2));
  	  else
              output_printf
!               (diagnostic_buffer, "In function `%s':\n",
                 (*decl_printable_name) (current_function_decl, 2));
  	}
  
        record_last_error_function ();
        output_to_stream (diagnostic_buffer, stderr);
--- 1221,1239 ----
        output_set_prefix (diagnostic_buffer, prefix);
        
        if (current_function_decl == NULL)
            output_add_string (diagnostic_buffer, "At top level:");
        else
  	{
  	  if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
              output_printf
!               (diagnostic_buffer, "In method `%s':",
                 (*decl_printable_name) (current_function_decl, 2));
  	  else
              output_printf
!               (diagnostic_buffer, "In function `%s':",
                 (*decl_printable_name) (current_function_decl, 2));
  	}
+       output_add_newline (diagnostic_buffer);
  
        record_last_error_function ();
        output_to_stream (diagnostic_buffer, stderr);
Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/error.c,v
retrieving revision 1.125
diff -p -r1.125 error.c
*** error.c	2000/08/23 09:31:12	1.125
--- error.c	2000/08/24 07:33:31
*************** print_instantiation_context ()
*** 2594,2597 ****
--- 2594,2598 ----
  {
    print_instantiation_partial_context
      (diagnostic_buffer, current_instantiation (), input_filename, lineno);
+   flush_diagnostic_buffer ();
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]