This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA][fortran] Fix # <line> <file> handling in the Fortran front-end


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]