Common/Logging/Log: Wrap GENERIC_LOG macro's body in do { } while (0)

Enforces the termination of GENERIC_LOGs with semicolons.
This commit is contained in:
Lioncash
2018-04-16 12:08:16 -04:00
parent 6224b9bd37
commit b0dc823472
2 changed files with 11 additions and 10 deletions

View File

@ -91,33 +91,34 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char*
// Let the compiler optimize this out
#define GENERIC_LOG(t, v, ...) \
do \
{ \
if (v <= MAX_LOGLEVEL) \
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
}
} while (0)
#define ERROR_LOG(t, ...) \
do \
{ \
GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) \
GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__); \
} while (0)
#define WARN_LOG(t, ...) \
do \
{ \
GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) \
GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__); \
} while (0)
#define NOTICE_LOG(t, ...) \
do \
{ \
GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) \
GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__); \
} while (0)
#define INFO_LOG(t, ...) \
do \
{ \
GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) \
GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__); \
} while (0)
#define DEBUG_LOG(t, ...) \
do \
{ \
GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) \
GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__); \
} while (0)