Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Interface generation as independent step

A number of years ago, we switched over to performing automatic interface generation and compile-time interface checking to help check our coding habits.  One issue we're repeatedly running into however is that we run into a chicken-and-egg problem when compiling, since you will only have the module files available for a file after it has been compiled.  Thus, the first routine to be compiled will not be checked against any modules, the second will only be checked against the first, etc.  We could take two passes through the source, compiling everything and generating modules, then deleting the compiled objects, and taking a second pass compiling again, this time checking interfaces, but with an extensive code base this would add significantly to our compile process.

I can't seem to find a compile flag that would just generate a set of interface files for the input source and stop prior to compilation.  If such an option doesn't exist, can we do a feature request for one?  Assuming the interface generation step is relatively lightweight, this would allow us to take a fast pass through all the code to generate the interface files (much in the same way we currently do with dependency generation for GNU 'make'), followed by a single pass through the source tree to compile once all of the interface files are available.

Also, related question: is there a way to compile a user-written .f90 interface file into a binary .mod file?

0 Kudos
1 Reply
Highlighted

"-syntax-only -gen-interface"

"-syntax-only -gen-interface" should do what you want.

If you are asking about how to compile your own interface into something -warn interface will use, you'd have to compile the interface with -c and then rename the .mod to be procname__genmod.mod

Retired 12/31/2016
0 Kudos