[CMake] ccmake and fortran

Arjen Markus arjen.markus at wldelft.nl
Tue Aug 15 02:44:02 EDT 2006


Hello all,

I guess I got side-tracked about the exact nature of the problem - 
recognising
those lines that can possibly contain dependency information - as opposed
to the problem of determining comment lines ;).

>>
>> I am for easy, and having to specify this is difficult for cmake 
>> developers and
>> for cmake users.   The only thing cmake is parsing the files for is 
>> to create
>> depend information, that is it.   I have not yet seen a case where 
>> the cC*dD starting a
>> line would cause incorrect depend information and still be valid 
>> fortran code.
>
Lines starting with d or D in fixed form source are regarded as comment, 
unless
you explicitly want to have them compiled. I am not sure whether they 
are part
of the Fortran 90/95 standard, but it was a popular extension for 
FORTRAN 77.

That said, look at the following source fragment:

C        Include the debug code only if we really want it ....     
D        INCLUDE 'debug_code.inc'

If all lines starting with d or D would be regarded as comment, CMake would
miss this dependency.

Note: this feature of conditionally compiled source code does not exist with
the free form.

>
> OK. That statement about the limited nature of the parsing is 
> reassuring so
> would somebody please commit the solution, i.e.,
>
> <fixed_fmt>^[cC*dD].*\n { return EOSTMT; }
>
> to:
>
> ^[cC*dD].*\n { return EOSTMT; }
>
> that Bryan Walsh has already worked out?

Please reduce that to:

^[cC*].*\n { return EOSTMT; }

and you will not miss any dependencies as far as I can tell.

(I was wondering about false positives, like when you have
"INCLUDE 'filename'" or "USE module" in a literal string,
but it should be relatively easy to detect them. The following
fragment could cause a false dependency:

write(*,*) 'Usage: &
&    use mymodule &
&        only mysub'

unless you are careful with the REs.)

Regards,

Arjen



More information about the CMake mailing list