mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: wrap 'if' in macros into 'do { ... } while (false)', so it does not break on following 'else'.
This commit is contained in:
parent
e0bd1dd42e
commit
4d2fc28834
|
@ -34,7 +34,7 @@
|
|||
* @param level The maximum debug level this message should be shown at. When the debug level for this category is set lower, then the message will not be shown.
|
||||
* @param format_string The formatting string of the message.
|
||||
*/
|
||||
#define Debug(category, level, format_string, ...) if ((level) == 0 || _debug_ ## category ## _level >= (level)) DebugPrint(#category, level, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__))
|
||||
#define Debug(category, level, format_string, ...) do { if ((level) == 0 || _debug_ ## category ## _level >= (level)) DebugPrint(#category, level, fmt::format(FMT_STRING(format_string), ## __VA_ARGS__)); } while (false)
|
||||
void DebugPrint(const char *category, int level, const std::string &message);
|
||||
|
||||
extern int _debug_driver_level;
|
||||
|
|
|
@ -392,7 +392,7 @@ void NORETURN AssertFailedError(int line, const char *file, const char *expressi
|
|||
/* For non-debug builds with assertions enabled use the special assertion handler. */
|
||||
#if defined(NDEBUG) && defined(WITH_ASSERT)
|
||||
# undef assert
|
||||
# define assert(expression) if (unlikely(!(expression))) AssertFailedError(__LINE__, __FILE__, #expression);
|
||||
# define assert(expression) do { if (unlikely(!(expression))) AssertFailedError(__LINE__, __FILE__, #expression); } while (false)
|
||||
#endif
|
||||
|
||||
/* Define JSON_ASSERT, which is used by nlohmann-json. Otherwise the header-file
|
||||
|
|
Loading…
Reference in New Issue