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]
Other format: [Raw text]

[gfortran] PR 19182


PR 19182 claims that error printing is slow.  In the comments it is suggested
to set the buffering of stderr to line buffering mode, and it is claimed that
this indeed accelerates stuff.  This should cause no harm, as our error
messages will always be terminated by a line break.

Alternatively, we could always assemble complete lines before printing, and
then call fputs.  This would save us possible overhead from calling the
library, but comes at the price of needing some slight restructuring of the
error printing code, which is out of place right now, especially given that
Steven said he'd prefer this to be rewritten to use gcc's common error
printing facilities.

Built and tested, ok?

- Tobi

2005-01-04  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/19182
	* error.c (gfc_error_init_1): Make stderr line-buffered.

Index: error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/error.c,v
retrieving revision 1.9
diff -u -p -r1.9 error.c
--- error.c     3 Jan 2005 21:43:49 -0000       1.9
+++ error.c     4 Jan 2005 23:46:59 -0000
@@ -46,6 +46,9 @@ static gfc_error_buf error_buffer, warni
 void
 gfc_error_init_1 (void)
 {
+  /* Set stderr to line-buffered to speed up error-printing.  */
+  setvbuf (stderr, NULL, _IOLBF, 0);
+
   terminal_width = gfc_terminal_width ();
   errors = 0;
   warnings = 0;


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