Rework module enable logic

This commit is contained in:
Henrik Stickann 2022-05-01 18:16:00 +02:00
parent 16dbc1c81e
commit ebe0a04325

View File

@ -3,9 +3,9 @@
* *
* Configuration: * Configuration:
* STA_DEBUG_SERIAL_ENABLE: Enable module * STA_DEBUG_SERIAL_ENABLE: Enable module
* STA_DEBUG_SERIAL_DISABLE: Forces module off when defined * STA_DEBUG_SERIAL_FORCE: Ignore debug defines and always enable output
* DEBUG: Automatically enables module when defined * DEBUG: Enables output when defined
* NDEBUG: Forces module off when defined * NDEBUG: Disables output when defined (overrides DEBUG)
* *
* The `sta::DebugSerial` instance must be provided. * The `sta::DebugSerial` instance must be provided.
* NOTE: Include this header before the definition because * NOTE: Include this header before the definition because
@ -17,17 +17,15 @@
#include <sta/config.hpp> #include <sta/config.hpp>
#ifdef DEBUG // Check only if STA_DEBUG_SERIAL_FORCE is not defined
# ifndef STA_DEBUG_SERIAL_ENABLE #ifndef STA_DEBUG_SERIAL_FORCE
# define STA_DEBUG_SERIAL_ENABLE // Disable module if NDEBUG is defined or DEBUG is not
# endif // !STA_DEBUG_SERIAL_ENABLE # if defined(NDEBUG) || !defined(DEBUG)
#endif // DEBUG # ifdef STA_DEBUG_SERIAL_ENABLE
# undef STA_DEBUG_SERIAL_ENABLE
#if defined(NDEBUG) || defined(STA_DEBUG_SERIAL_DISABLE) # endif // STA_DEBUG_SERIAL_ENABLE
# ifdef STA_DEBUG_SERIAL_ENABLE # endif // NDEBUG || !DEBUG
# undef STA_DEBUG_SERIAL_ENABLE #endif // !STA_DEBUG_SERIAL_FORCE
# endif // STA_DEBUG_SERIAL_ENABLE
#endif // NDEBUG || STA_DEBUG_SERIAL_DISABLE
#ifdef STA_DEBUG_SERIAL_ENABLE #ifdef STA_DEBUG_SERIAL_ENABLE