I would like to be sure such a change would be welcome before putting in the work. :)
To be clear, suggestion is not to do more work. My suggestion is:
- Add your new macro with a name like
LOG_CATEGORY
, to be clear that it is a macro and not something that evaluated like a normal function.
- Leave
LogPrint
alone, mark it deprecated and add a note like “LOG_CATEGORY is preferred over LogPrint in new code as a more performant alternative”
Separately after that, I do not think it would take a lot of work to replace instances of LogPrint
and remove it. We could start with a simple scripted-diff to replace simple variable references that obviously don’t have side effects.
0git grep -l LogPrint | xargs sed -i 's/LogPrint\((BCLog::[A-Z]\+, "[^"]\+"\(, [A-Za-z_]\+\)*)\)/LOG_CATEGORY\1/g'
As for organizing these changes, I might consider closing this PR, and instead adding the new macro directly where you intend to use it in #16688.