This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA][fortran] Fix # <line> <file> handling in the Fortran front-end
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Jeff Law <law at redhat dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 4 May 2018 12:55:05 -0700
- Subject: Re: [RFA][fortran] Fix # <line> <file> handling in the Fortran front-end
- References: <704e1a86-f096-9418-818b-d0d322a8c1f5@redhat.com>
- Reply-to: sgk at troutmask dot apl dot washington dot edu
On Fri, May 04, 2018 at 01:32:00PM -0600, Jeff Law wrote:
>
> The Fortran front end has its own code to parse # <line> <file>
> directives. We've run into a case where it does not function correctly.
> In particular when the directive changes the current file, subsequent
> diagnostics still refer to the original filename.
>
> Concretely take this code and compile it with -Wall:
>
> # 12345 "foo-f"
> SUBROUTINE s(dummy)
> INTEGER, INTENT(in) :: dummy
> END SUBROUTINE
Can you tell us where the above comes from?
If I have the three lines of code in a file
name 'a.inc', and use either the Fortran
INCLUDE statement or a cpp #include statement
I get what I expect.
% cat a.f90
module bar
contains
include 'a.inc'
end module bar
% gfcx -c -Wall a.f90
a.inc:1:18:
SUBROUTINE s(dummy)
1
Warning: Unused dummy argument 'dummy' at (1) [-Wunused-dummy-argument]
% cat a.F90
module bar
contains
#include "a.inc"
end module bar
% gfcx -c -Wall a.F90
a.inc:1:18:
SUBROUTINE s(dummy)
1
Warning: Unused dummy argument 'dummy' at (1) [-Wunused-dummy-argument]
>
> Bootstrapped and regression tested on x86_64-linux-gnu. OK for the trunk?
>
I don't have any objection to the patch, but I would like
to understand where '# 12345 "foo-f"' comes from.
--
Steve