Skip to content

Commit

Permalink
[metalibm#37] Switching from error to warning for pass multi registra…
Browse files Browse the repository at this point in the history
…tion

Details:
*   + When trying to register a pass class multiple times with the same tag
*     an error used to be generated, this behaviour has been changed to a
*     simple warning (as sphinx doc building seems to import optimization pass
*     multiple times)
  • Loading branch information
nibrunie committed Nov 3, 2019
1 parent 17d3f9c commit 9a13ec5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metalibm_core/core/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ def register(pass_class):
Log.report(LOG_PASS_INFO, "registering pass {} associated to tag {}".format(pass_class, tag))
Pass.pass_map[tag] = pass_class
else:
Log.report(Log.Error, "a pass with name {} has already been registered while trying to register {}".format(tag, pass_class))
if Pass.pass_map[tag] == pass_class:
Log.report(Log.Warning, "trying to register {} multiple times (always associated with {})", tag, pass_class)
else:
Log.report(Log.Error, "a pass with name {} ({}) has already been registered while trying to register {}".format(tag, Pass.pass_map[tag], pass_class))

## return the pass class associated with name @p tag
# @param tag[str] pass name
Expand Down

0 comments on commit 9a13ec5

Please sign in to comment.