Commit 47cc2d49 by Tobias Burnus Committed by Tobias Burnus

Fortran] PR91253 fix continuation-line handling with -pre_include

        PR fortran/91253
        * scanner.c (skip_fixed_comments): Move comment
        lines to next if block.
        (gfc_next_char_literal): Fix continue_line setting.
        (get_file): Remove bogus ATTRIBUTE_UNUSED.

From-SVN: r277948
parent bc5b2b68
2019-11-08 Tobias Burnus <tobias@codesourcery.com
PR fortran/91253
* scanner.c (skip_fixed_comments): Move comment
lines to next if block.
(gfc_next_char_literal): Fix continue_line setting.
(get_file): Remove bogus ATTRIBUTE_UNUSED.
2019-11-06 Jerry DeLisle <jvdelisle@gcc.ngu.org> 2019-11-06 Jerry DeLisle <jvdelisle@gcc.ngu.org>
PR fortran/90374 PR fortran/90374
......
...@@ -1050,6 +1050,10 @@ skip_fixed_comments (void) ...@@ -1050,6 +1050,10 @@ skip_fixed_comments (void)
return; return;
} }
if (gfc_current_locus.lb != NULL
&& continue_line < gfc_linebuf_linenum (gfc_current_locus.lb))
continue_line = gfc_linebuf_linenum (gfc_current_locus.lb);
/* If -fopenmp/-fopenacc, we need to handle here 2 things: /* If -fopenmp/-fopenacc, we need to handle here 2 things:
1) don't treat !$omp/!$acc|c$omp/c$acc|*$omp / *$acc as comments, 1) don't treat !$omp/!$acc|c$omp/c$acc|*$omp / *$acc as comments,
but directives but directives
...@@ -1057,10 +1061,6 @@ skip_fixed_comments (void) ...@@ -1057,10 +1061,6 @@ skip_fixed_comments (void)
!$|c$|*$ should be treated as 2 spaces if the characters !$|c$|*$ should be treated as 2 spaces if the characters
in columns 3 to 6 are valid fixed form label columns in columns 3 to 6 are valid fixed form label columns
characters. */ characters. */
if (gfc_current_locus.lb != NULL
&& continue_line < gfc_linebuf_linenum (gfc_current_locus.lb))
continue_line = gfc_linebuf_linenum (gfc_current_locus.lb);
if ((flag_openmp || flag_openmp_simd) && !flag_openacc) if ((flag_openmp || flag_openmp_simd) && !flag_openacc)
{ {
if (next_char () == '$') if (next_char () == '$')
...@@ -1313,6 +1313,14 @@ restart: ...@@ -1313,6 +1313,14 @@ restart:
if (flag_openacc) if (flag_openacc)
prev_openacc_flag = openacc_flag; prev_openacc_flag = openacc_flag;
/* This can happen if the input file changed or via cpp's #line
without getting reset (e.g. via input_stmt). It also happens
when pre-including files via -fpre-include=. */
if (continue_count == 0
&& gfc_current_locus.lb
&& continue_line > gfc_linebuf_linenum (gfc_current_locus.lb) + 1)
continue_line = gfc_linebuf_linenum (gfc_current_locus.lb) + 1;
continue_flag = 1; continue_flag = 1;
if (c == '!') if (c == '!')
skip_comment_line (); skip_comment_line ();
...@@ -1475,6 +1483,14 @@ restart: ...@@ -1475,6 +1483,14 @@ restart:
if (flag_openacc) if (flag_openacc)
prev_openacc_flag = openacc_flag; prev_openacc_flag = openacc_flag;
/* This can happen if the input file changed or via cpp's #line
without getting reset (e.g. via input_stmt). It also happens
when pre-including files via -fpre-include=. */
if (continue_count == 0
&& gfc_current_locus.lb
&& continue_line > gfc_linebuf_linenum (gfc_current_locus.lb) + 1)
continue_line = gfc_linebuf_linenum (gfc_current_locus.lb) + 1;
continue_flag = 1; continue_flag = 1;
old_loc = gfc_current_locus; old_loc = gfc_current_locus;
...@@ -1943,7 +1959,7 @@ next_char: ...@@ -1943,7 +1959,7 @@ next_char:
the file stack. */ the file stack. */
static gfc_file * static gfc_file *
get_file (const char *name, enum lc_reason reason ATTRIBUTE_UNUSED) get_file (const char *name, enum lc_reason reason)
{ {
gfc_file *f; gfc_file *f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment