From 167e6b4d62896ff3604137b95d00b440932338f8 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 26 May 2016 02:19:44 +0200 Subject: [PATCH] Define macro for debug-only code --- application/argumentparser.cpp | 2 +- application/global.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/application/argumentparser.cpp b/application/argumentparser.cpp index fec88d6..7b98ec6 100644 --- a/application/argumentparser.cpp +++ b/application/argumentparser.cpp @@ -459,7 +459,7 @@ void ArgumentParser::verifySetup() const void ArgumentParser::parseArgs(int argc, char *argv[]) { // initiate parser - verifySetup(); + IF_DEBUG_BUILD(verifySetup();) m_actualArgc = 0; // reset actual agument count unsigned int actualArgc = 0; int valuesToRead = 0; diff --git a/application/global.h b/application/global.h index 220bde4..ab8b743 100644 --- a/application/global.h +++ b/application/global.h @@ -82,4 +82,15 @@ #define VAR_UNUSED(x) (void)x; +/*! + * \def IF_DEBUG_BUILD + * \brief Wraps debug-only lines conveniently. + */ + +#ifdef DEBUG_BUILD +# define IF_DEBUG_BUILD(x) x +#else +# define IF_DEBUG_BUILD(x) +#endif + #endif // MARTCHUSUTILITY_LIBRARY_GLOBAL_H