+2018-05-07 Jeff Law <law@redhat.comg>
+
+ * scanner.c (preprocessor_line): Call linemap_add after a line
+ directive that changes the current filename.
+
2018-05-06 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/85507
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. */
+2018-05-07 Jeff Law <law@redhat.com>
+
+ * gfortran.dg/linefile.f90: New test.
+
2018-05-07 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.dg/nextafter-2.c: Add c99_runtime effective target
--- /dev/null
+! { dg-do compile }
+! { dg-options "-Wall" }
+
+! This will verify that the # <line> <file> directive later does not
+! mess up the diagnostic on this line
+SUBROUTINE s(dummy) ! { dg-warning "Unused" }
+ INTEGER, INTENT(in) :: dummy
+END SUBROUTINE
+
+# 12345 "foo-f"
+SUBROUTINE s2(dummy)
+ INTEGER, INTENT(in) :: dummy
+END SUBROUTINE
+! We want to check that the # directive changes the filename in the
+! diagnostic. Nothing else really matters here. dg-regexp allows us
+! to see the entire diagnostic. We just have to make sure to consume
+! the entire message.
+! { dg-regexp "foo-f\[^\n]*" }