Commit 0d1f4de9 by Jeff Law

scanner.c (preprocessor_line): Call linemap_add after a line directive that…

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
parent a989f637
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
......
......@@ -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. */
......
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
......
! { 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]*" }
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