[patch, fortran] Remove redundant check in error.c

FX Coudert fxcoudert@gmail.com
Mon Mar 26 22:31:00 GMT 2007


>> I added this TODO about a year ago, because at that point I wasn't  
>> completely sure if this particular check was needed or not.  It  
>> still looks like a no-op to me -- the only things that affect the  
>> "offset" variable are that it's set to zero some dozen lines above  
>> the patch region, and of course the two lines of context in the  
>> top of the patch -- and so I'm now proposing to remove it.

It's OK. On a side note, it lead me to realized that, at some point,  
we might want to improve the rather short gfc_terminal_width function  
by something along the lines of (code borrowed to gcc/opts.c):

Index: gcc/fortran/misc.c
===================================================================
--- gcc/fortran/misc.c  (revision 123017)
+++ gcc/fortran/misc.c  (working copy)
@@ -22,6 +22,8 @@
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "gfortran.h"
/* Get a block of memory.  Many callers assume that the memory we
@@ -65,7 +67,23 @@
int
gfc_terminal_width (void)
{
-  return 80;
+  const char *p;
+  int width = 0;
+
+  GET_ENVIRONMENT (p, "COLUMNS");
+  if (p != NULL)
+    {
+      int value = atoi (p);
+
+      if (value > 0)
+        width = value;
+    }
+
+  if (width == 0)
+    /* Use a reasonable default.  */
+    width = 80;
+
+  return width;
}




More information about the Gcc-patches mailing list