Detect and error on duplicate module definitions
Module names must be unique in order for dependency analysis to work. (This is after preprocessing) Therefore if two source files contain modules with the same name (or worse a single file with duplicate modules) that is an error condition. It should be reported and build aborted.
There is a comment in analysis:
if duplicates:
# we don't break the build because these symbols might not be
# required to build the executable.
# todo: put a big warning at the end of the build?
Not sure if this reason is good enough. FWIW, in a tool in psyclone we collect all warning and error messages, and the caller can query these messages to handle them later. Am happy to port this tool across if that should be useful.
UMDP3 coding standards state that modules should not be used twice (presumably actually more than once?):
For code portability, be careful not to
USE <module>twice in a routine for the same MODULE, especially where usingONLY. This can lead to compiler Warning and Error messages.
For this reason, I think it's reasonable to cause the build to fail - at least as a default action.
After having a quick chat with @t00sa I'm happy to pick up this issue and start work on it.