+2006-10-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/19262
+ * gfortran.h (gfc_option_t): Add max_continue_fixed and max_continue_free.
+ * options.c (gfc_init_options): Initialize fixed form and free form
+ consecutive continuation line limits.
+ * scanner.c (gfc_scanner_init_1): Initialize continue_line
+ and continue_count. (gfc_next_char_literal): Count the number of
+ continuation lines in the current statement and warn if
+ limit is exceeded.
+
+2006-10-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/19260
+ * scanner.c (gfc_next_char_literal): Add check for missing '&'
+ and warn if in_string, otherwise return ' '.
+
2006-10-02 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/29210
gfc_option.source_form = FORM_UNKNOWN;
gfc_option.fixed_line_length = -1;
gfc_option.free_line_length = -1;
+ gfc_option.max_continue_fixed = 19;
+ gfc_option.max_continue_free = 39;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
gfc_option.verbose = 0;
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
| GFC_STD_F2003 | GFC_STD_F95;
gfc_option.warn_std = GFC_STD_F95_OBS;
+ gfc_option.max_continue_fixed = 255;
+ gfc_option.max_continue_free = 255;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
break;
static gfc_file *file_head, *current_file;
static int continue_flag, end_flag, openmp_flag;
+static int continue_count, continue_line;
static locus openmp_locus;
gfc_source_form gfc_current_form;
static FILE *gfc_src_file;
static char *gfc_src_preprocessor_lines[2];
+extern int pedantic;
/* Main scanner initialization. */
line_head = NULL;
line_tail = NULL;
+ continue_count = 0;
+ continue_line = 0;
+
end_flag = 0;
}
restart:
c = next_char ();
if (gfc_at_end ())
- return c;
+ {
+ continue_count = 0;
+ return c;
+ }
if (gfc_current_form == FORM_FREE)
{
else
gfc_advance_line ();
- /* We've got a continuation line and need to find where it continues.
- First eat any comment lines. */
+ /* We've got a continuation line. If we are on the very next line after
+ the last continuation, increment the continuation line count and
+ check whether the limit has been exceeded. */
+ if (gfc_current_locus.lb->linenum == continue_line + 1)
+ {
+ if (++continue_count == gfc_option.max_continue_free)
+ {
+ if (gfc_notification_std (GFC_STD_GNU)
+ || pedantic)
+ gfc_warning ("Limit of %d continuations exceeded in statement at %C",
+ gfc_option.max_continue_free);
+ }
+ }
+ continue_line = gfc_current_locus.lb->linenum;
+
+ /* Now find where it continues. First eat any comment lines. */
gfc_skip_comments ();
if (prev_openmp_flag != openmp_flag)
if (c != '&')
{
- if (in_string && gfc_option.warn_ampersand)
- gfc_warning ("Missing '&' in continued character constant at %C");
-
- gfc_current_locus.nextc--;
+ if (in_string)
+ {
+ if (gfc_option.warn_ampersand)
+ gfc_warning_now ("Missing '&' in continued character constant at %C");
+ gfc_current_locus.nextc--;
+ }
+ else
+ {
+ c = ' ';
+ gfc_current_locus = old_loc;
+ goto done;
+ }
}
}
else
c = next_char ();
if (c == '0' || c == ' ' || c == '\n')
goto not_continuation;
+
+ /* We've got a continuation line. If we are on the very next line after
+ the last continuation, increment the continuation line count and
+ check whether the limit has been exceeded. */
+ if (gfc_current_locus.lb->linenum == continue_line + 1)
+ {
+ if (++continue_count == gfc_option.max_continue_fixed)
+ {
+ if (gfc_notification_std (GFC_STD_GNU)
+ || pedantic)
+ gfc_warning ("Limit of %d continuations exceeded in statement at %C",
+ gfc_option.max_continue_fixed);
+ }
+ }
+
+ if (continue_line < gfc_current_locus.lb->linenum)
+ continue_line = gfc_current_locus.lb->linenum;
}
/* Ready to read first character of continuation line, which might
gfc_current_locus = old_loc;
done:
+ if (c == '\n')
+ continue_count = 0;
continue_flag = 0;
return c;
}