aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>2018-05-07 12:24:59 -0600
committerJeff Law <law@gcc.gnu.org>2018-05-07 12:24:59 -0600
commit0d1f4de97d9b51e04f6678448fb7c796a8fba6b1 (patch)
treed02b9d2d698cff5b5b95e470ba9ab2a48256219c /gcc/fortran/scanner.c
parenta989f6378b1b08aa3145c7bd77477282ddc5e553 (diff)
downloadgcc-0d1f4de97d9b51e04f6678448fb7c796a8fba6b1.zip
gcc-0d1f4de97d9b51e04f6678448fb7c796a8fba6b1.tar.gz
gcc-0d1f4de97d9b51e04f6678448fb7c796a8fba6b1.tar.bz2
scanner.c (preprocessor_line): Call linemap_add after a line directive that changes the current filename.
* scanner.c (preprocessor_line): Call linemap_add after a line directive that changes the current filename. * gfortran.dg/linefile.f90: New test. From-SVN: r260010
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r--gcc/fortran/scanner.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index aab5379..55d6daf 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -2107,6 +2107,10 @@ preprocessor_line (gfc_char_t *c)
in the linemap. Alternative could be using GC or updating linemap to
point to the new name, but there is no API for that currently. */
current_file->filename = xstrdup (filename);
+
+ /* We need to tell the linemap API that the filename changed. Just
+ changing current_file is insufficient. */
+ linemap_add (line_table, LC_RENAME, false, current_file->filename, line);
}
/* Set new line number. */