]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/fortran/scanner.c
Update FSF address.
[gcc.git] / gcc / fortran / scanner.c
index cab85f4dcfa5bc4f028dbf1d8a9f4e98367e7f2f..5aaecdb2ed99e9e1e9ec6bc8b45239ea4dd8a54e 100644 (file)
@@ -17,8 +17,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 /* Set of subroutines to (ultimately) return the next character to the
    various matching subroutines.  This file's job is to read files and
@@ -458,6 +458,9 @@ restart:
            }
          while (c != '\n');
 
+         /* Avoid truncation warnings for comment ending lines.  */
+         gfc_current_locus.lb->truncated = 0;
+
          goto done;
        }
 
@@ -525,6 +528,9 @@ restart:
              c = next_char ();
            }
          while (c != '\n');
+
+         /* Avoid truncation warnings for comment ending lines.  */
+         gfc_current_locus.lb->truncated = 0;
        }
 
       if (c != '\n')
@@ -631,21 +637,17 @@ gfc_error_recovery (void)
          if (c == delim)
            break;
          if (c == '\n')
-           goto done;
+           return;
          if (c == '\\')
            {
              c = next_char ();
              if (c == '\n')
-               goto done;
+               return;
            }
        }
       if (gfc_at_eof ())
        break;
     }
-
-done:
-  if (c == '\n')
-    gfc_advance_line ();
 }
 
 
@@ -677,12 +679,14 @@ gfc_gobble_whitespace (void)
    need be.
    In fixed mode, we expand a tab that occurs within the statement
    label region to expand to spaces that leave the next character in
-   the source region.  */
+   the source region.
+   load_line returns wether the line was truncated.  */
 
-static void
-load_line (FILE * input, char **pbuf, char *filename, int linenum)
+static int
+load_line (FILE * input, char **pbuf)
 {
-  int c, maxlen, i, trunc_flag, preprocessor_flag;
+  int c, maxlen, i, preprocessor_flag;
+  int trunc_flag = 0;
   static int buflen = 0;
   char *buffer;
 
@@ -760,22 +764,13 @@ load_line (FILE * input, char **pbuf, char *filename, int linenum)
       else if (i >= buflen)
        {                       
          /* Truncate the rest of the line.  */
-         trunc_flag = 1;
-
          for (;;)
            {
              c = fgetc (input);
              if (c == '\n' || c == EOF)
                break;
 
-             if (gfc_option.warn_line_truncation
-                 && trunc_flag
-                 && !gfc_is_whitespace (c))
-               {
-                 gfc_warning_now ("%s:%d: Line is being truncated",
-                                  filename, linenum);
-                 trunc_flag = 0;
-               }
+             trunc_flag = 1;
            }
 
          ungetc ('\n', input);
@@ -791,6 +786,8 @@ load_line (FILE * input, char **pbuf, char *filename, int linenum)
       *buffer++ = ' ';
 
   *buffer = '\0';
+
+  return trunc_flag;
 }
 
 
@@ -1034,7 +1031,7 @@ load_file (char *filename, bool initial)
 
   for (;;) 
     {
-      load_line (input, &line, filename, current_file->line);
+      int trunc = load_line (input, &line);
 
       len = strlen (line);
       if (feof (input) && len == 0)
@@ -1066,6 +1063,7 @@ load_file (char *filename, bool initial)
       b->linenum = current_file->line++;
 #endif
       b->file = current_file;
+      b->truncated = trunc;
       strcpy (b->line, line);
 
       if (line_head == NULL)
This page took 0.033805 seconds and 5 git commands to generate.