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]

Re: Linewrapping default for error messages set to $COLUMNS


Hi,

> > I think it is usefull to wrap lines at getenv ("COLUMNS") characters
> > instead of using 80 as default.
> > This small patch to the cvs HEAD branch changes this behavour.
> >
> > Could you please apply this patch!
>
> The code needs to follow the GNU coding standards re whitespace, and to
> use the GET_ENVIRONMENT macro.
Ok, I have changed this now.

> The rest is Gaby's call.
Ok, thank you!

   Thank you for reviewing

      Mathias Fröhlich

--- gcc/gcc/cp/ChangeLog.orig	Wed Jan 15 11:27:40 2003
+++ gcc/gcc/cp/ChangeLog	Wed Jan 15 11:57:31 2003
@@ -1,3 +1,8 @@
+2003-01-14  Mathias Froehlich  <Mathias.Froehlich@web.de>
+
+	* cp/lex.c (cxx_get_columns): New function.
+	(cxx_init_options): Wrap lines at cxx_get_columns () characters.
+
 2003-01-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* decl2.c (check_classfn): Fix uninitialized warning.
--- gcc/gcc/cp/lex.c.orig	Sun Jan 12 13:46:26 2003
+++ gcc/gcc/cp/lex.c	Wed Jan 15 12:04:54 2003
@@ -154,6 +154,20 @@
 				   to behave according to #pragma interface.  */
 
 
+/* Get the terminal width */
+static int
+cxx_get_columns ()
+{
+  int columns = 80;
+  const char *env;
+
+  GET_ENVIRONMENT (env, "COLUMNS");
+  if (env)
+    columns = atoi (env);
+
+  return columns;
+}
+
 /* Initialization before switch parsing.  */
 void
 cxx_init_options ()
@@ -162,9 +176,8 @@
 
   /* Default exceptions on.  */
   flag_exceptions = 1;
-  /* By default wrap lines at 80 characters.  Is getenv ("COLUMNS")
-     preferable?  */
-  diagnostic_line_cutoff (global_dc) = 80;
+  /* By default wrap lines at getenv ("COLUMNS") characters. */
+  diagnostic_line_cutoff (global_dc) = cxx_get_columns ();
   /* By default, emit location information once for every
      diagnostic message.  */
   diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;


-- 
Mathias Fröhlich, e-mail: Mathias.Froehlich@web.de


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