Closed TeranIvy closed 5 years ago
I've just looked at the Fortran2003 spec [https://wg5-fortran.org/N1601-N1650/N1601.pdf] and on page 468 it gives an example of use module_name, only :
. The reason for doing this would be to keep variables inside the module in-scope e.g. when two children subroutines called from a parent subroutine want to use the module, the information would go out-of-scope when in the parent subroutine. However, whilst adding use module_name, only :
disallows the parent subroutine from using the data, it does keep the module in-scope so that the children subroutines can share data from within the module.
Created empty_only branch to work on this
I learned something about F2003 here, thanks for explaining! As I said yesterday in Telco, I am happy to take on the review after PR is issued.
Thanks @TeranIvy. I'm about to create a PR and assign it to you.
PR #122 merged, closing issue.
Apparently,
use module_name, only:
is valid Fortran. The example used is below.This example compiles with Intel 17.0.1 and Gnu 6.1.0 and the effect of
use module_name, only:
is that nothing from themodule_name
gets used so it is effectively waste of code.fparser2 reports invalid Fortran:
Perhaps raising a warning for this case would be useful.