Two modules with the same name in one program

There are two different cases that an automatic tool needs to recognize. One is when there are two modules that both need to be used in the code that currently have the same name. In this case, the tool somehow needs to rename one or both of them, along with the corresponding USE statements. The other one is when there are several versions of the same *mod.f90 source codes in the directory. During development, it is not unusual to have several such files around, each of which might work using different algorithms, or designed toward different target environments, and so on. In this case, the programmer is responsible for compiling, loading, and executing the right combination of files, and the tool needs to be told to ignore the duplicate module names within these files.

Typically, such target-environment-dependent code might all be placed in a single source code, and the correct code blocks activated internally with conditional compilation macros. However, since fortran does not have a standard preprocessor for conditional compilation, many programmers prefer to avoid a preprocessor-based approach to this problem, and instead rely on the use of multiple files within the file system. Your automatic tool should probably attempt to accommodate both programming styles.

1 Like