gfortran.h (GFC_MAX_LINE): Remove constant definition.
authorBrooks Moses <brooks.moses@codesourcery.com>
Wed, 15 Nov 2006 03:52:03 +0000 (03:52 +0000)
committerBrooks Moses <brooks@gcc.gnu.org>
Wed, 15 Nov 2006 03:52:03 +0000 (19:52 -0800)
* gfortran.h (GFC_MAX_LINE): Remove constant definition.
(gfc_option_t): Clarify comments.
* options.c: Set default line length limits to actual default
values, rather than flag values.
* scanner.c: Eliminate checking and handling of the
fixed/free_line_length flag values.

From-SVN: r118842

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/options.c
gcc/fortran/scanner.c

index 9e1433c..709bc4b 100644 (file)
@@ -1,5 +1,14 @@
 2006-11-14  Brooks Moses  <brooks.moses@codesourcery.com>
  
+       * gfortran.h (GFC_MAX_LINE): Remove constant definition.
+       (gfc_option_t): Clarify comments.
+       * options.c: Set default line length limits to actual default
+       values, rather than flag values.
+       * scanner.c: Eliminate checking and handling of the
+       fixed/free_line_length flag values.
+
+2006-11-14  Brooks Moses  <brooks.moses@codesourcery.com>
        * lang.opt: Remove -fno-backend option.
        * gfortran.h (gfc_option_t): Remove flag_no_backend.
        * options.c (gfc_init_options): Remove flag_no_backend.
index a369d32..cf0dabf 100644 (file)
@@ -55,8 +55,7 @@ char *alloca ();
 
 /* Major control parameters.  */
 
-#define GFC_MAX_SYMBOL_LEN 63
-#define GFC_MAX_LINE 132       /* Characters beyond this are not seen.  */
+#define GFC_MAX_SYMBOL_LEN 63   /* Must be at least 63 for F2003.  */
 #define GFC_MAX_DIMENSIONS 7   /* Maximum dimensions in an array.  */
 #define GFC_LETTERS 26         /* Number of letters in the alphabet.  */
 
@@ -1602,20 +1601,16 @@ typedef struct
 {
   char *module_dir;
   gfc_source_form source_form;
-  /* When fixed_line_length or free_line_length are 0, the whole line is used.
-
-     Default is -1, the maximum line length mandated by the respective source
-     form is used:
-     for FORM_FREE GFC_MAX_LINE (132)
-     else 72.
-
-     If fixed_line_length or free_line_length is not 0 nor -1 then the user has
-     requested a specific line-length.
+  /* Maximum line lengths in fixed- and free-form source, respectively.
+     When fixed_line_length or free_line_length are 0, the whole line is used,
+     regardless of length.
 
      If the user requests a fixed_line_length <7 then gfc_init_options()
      emits a fatal error.  */
-  int fixed_line_length; /* maximum line length in fixed-form.  */
-  int free_line_length; /* maximum line length in free-form.  */
+  int fixed_line_length;
+  int free_line_length;
+  /* Maximum number of continuation lines in fixed- and free-form source,
+     respectively.  */
   int max_continue_fixed;
   int max_continue_free;
   int max_identifier_length;
index 3d870b8..6afcaa4 100644 (file)
@@ -46,8 +46,8 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
   gfc_source_file = NULL;
   gfc_option.module_dir = NULL;
   gfc_option.source_form = FORM_UNKNOWN;
-  gfc_option.fixed_line_length = -1;
-  gfc_option.free_line_length = -1;
+  gfc_option.fixed_line_length = 72;
+  gfc_option.free_line_length = 132;
   gfc_option.max_continue_fixed = 19;
   gfc_option.max_continue_free = 39;
   gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
index b054904..92ee366 100644 (file)
@@ -956,33 +956,25 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
   int seen_printable = 0, seen_ampersand = 0;
   char *buffer;
 
-  /* Determine the maximum allowed line length.
-     The default for free-form is GFC_MAX_LINE, for fixed-form or for
-     unknown form it is 72. Refer to the documentation in gfc_option_t.  */
+  /* Determine the maximum allowed line length.  */
   if (gfc_current_form == FORM_FREE)
-    {
-      if (gfc_option.free_line_length == -1)
-       maxlen = GFC_MAX_LINE;
-      else
-       maxlen = gfc_option.free_line_length;
-    }
+    maxlen = gfc_option.free_line_length;
   else if (gfc_current_form == FORM_FIXED)
-    {
-      if (gfc_option.fixed_line_length == -1)
-       maxlen = 72;
-      else
-       maxlen = gfc_option.fixed_line_length;
-    }
+    maxlen = gfc_option.fixed_line_length;
   else
     maxlen = 72;
 
   if (*pbuf == NULL)
     {
-      /* Allocate the line buffer, storing its length into buflen.  */
+      /* Allocate the line buffer, storing its length into buflen.
+        Note that if maxlen==0, indicating that arbitrary-length lines
+        are allowed, the buffer will be reallocated if this length is
+        insufficient; since 132 characters is the length of a standard
+        free-form line, we use that as a starting guess.  */
       if (maxlen > 0)
        buflen = maxlen;
       else
-       buflen = GFC_MAX_LINE;
+       buflen = 132;
 
       *pbuf = gfc_getmem (buflen + 1);
     }