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