This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [Fortran, Patch] Fix CPP <include_path> (PR 37821)


Steve Kargl wrote:
> On Tue, Oct 21, 2008 at 06:28:15PM +0200, Tobias Burnus wrote:
>> first I would like to know how gfortran should handle the following:
>>
>> dir1/include_file
>> dir1/source_file1
>> dir2/source_file2
>>
>> $ gfortran dir1/source_file1 dir2/source_file2
>>
>> In "gcc" an
>>     #include "include_file"
>> succeeds for source_file1 but fails for source_file2.
>>
>> In "gfortran" a
>>    INCLUDE  "include_file"
>> will work for both source_file1 as for source_file2
>>
>> The question is what should happen for
>>    #include "include_file"
>> in gfortran?  The same as for C's #include "..." or the same as for
>> gfortran's INCLUDE?
>>
> 
> I think having the nonstandard #include match the Fortran INCLUDE
> behavior is desirable.  This then would permit a very simple change
> in the source code to remove a nonstandard feature in favor of an
> standard feature.

I was going to suggest the opposite :) That a) when using #include, we
should follow the 'normal' C rules, and b) the other behavior including
the Fortran INCLUDE is confusing, and should be changed to match C/CPP.
Consider:

gfortran dir1/source_file1 dir2/source_file2

currently works, but then the user decides to write a Makefile that does
the equivalent of

gfortran -c dir1/source_file1
gfortran -c dir2/source_file2

and suddenly it fails. Would changing the behavior of Fortran INCLUDE
wreck decades of de-facto standardization (obviously the standard itself
says nothing about include search paths)?

Otherwise, the patch is OK to commit as soon as there is some consensus
on what action to take on the above issue. Or if no other maintainer
weighs in on the topic, just do whatever you prefer in a few days.


-- 
Janne Blomqvist

Attachment: signature.asc
Description: OpenPGP digital signature


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