Skip to content

Commit b7e13ab

Browse files
authored
[flang][docs] Document technique for regenerating a module hermetically (#139975)
A flang-new module file is Fortran source, so it can be recompiled with the `-fhermetic-module-files` option to convert it into a hermetic one.
1 parent c26e752 commit b7e13ab

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

flang/docs/ModFiles.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,14 @@ modules of dependent libraries need not also be packaged with the library.
171171
When the compiler reads a hermetic module file, the copies of the dependent
172172
modules are read into their own scope, and will not conflict with other modules
173173
of the same name that client code might `USE`.
174+
175+
One can use the `-fhermetic-module-files` option when building the top-level
176+
module files of a library for which not all of the implementation modules
177+
will (or can) be shipped.
178+
179+
It is also possible to convert a default module file to a hermetic one after
180+
the fact.
181+
Since module files are Fortran source, simply copy the module file to a new
182+
temporary free form Fortran source file and recompile it (`-fsyntax-only`)
183+
with the `-fhermetic-module-files` flag, and that will regenerate the module
184+
file in place with all of its dependent modules included.

0 commit comments

Comments
 (0)