Define macro for debug-only code

This commit is contained in:
Martchus 2016-05-26 02:19:44 +02:00
parent f3077ef8e3
commit 4fcc8442f8
2 changed files with 12 additions and 3 deletions

View File

@ -441,9 +441,7 @@ void ArgumentParser::verifySetup() const
void ArgumentParser::parseArgs(int argc, char *argv[]) void ArgumentParser::parseArgs(int argc, char *argv[])
{ {
// initiate parser // initiate parser
#ifdef DEBUG_BUILD IF_DEBUG_BUILD(verifySetup();)
verifySetup();
#endif
m_actualArgc = 0; // reset actual agument count m_actualArgc = 0; // reset actual agument count
unsigned int actualArgc = 0; unsigned int actualArgc = 0;
int valuesToRead = 0; int valuesToRead = 0;

View File

@ -82,4 +82,15 @@
#define VAR_UNUSED(x) (void)x; #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 #endif // MARTCHUSUTILITY_LIBRARY_GLOBAL_H