mamedev / mame

MAME
https://www.mamedev.org/
Other
8.35k stars 2.03k forks source link

Code shouldn’t unnecessarily redefine LOG_GENERAL #10183

Open cuavas opened 2 years ago

cuavas commented 2 years ago

logmacro.h itself defines LOG_GENERAL to 1 (aka (1U << 0)) and uses it with the abbeviated LOG macro (as opposed to LOGMASKED) for convenience. Due to the way the preprocessor works, it’s safe to use LOG_GENERAL when defining VERBOSE before including logmacro.h itself.

In the interest of keeping things familiar, unless there’s a very good reason, code should not:

cuavas commented 2 years ago

Opening at the request of @MooglyGuy.

MooglyGuy commented 2 years ago

Thanks, replying so that hopefully Github will let you assign it to me now.

Question: With "don't redefine LOG", something like this would still be acceptable, yes?

#define LOGREGISTER(...) LOGMASKED(LOG_REGISTERS, __VA_ARGS__)

cuavas commented 2 years ago

Yes, that’s fine, just don’t redefine LOG itself to do something weird.