Changeset - r28622:281cf7fd7f53
[Not reviewed]
master
0 2 0
frosch - 3 months ago 2024-01-30 21:42:20
frosch@openttd.org
Codechange: wrap 'if' in macros into 'do { ... } while (false)', so it does not break on following 'else'.
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/debug.h
Show inline comments
 
@@ -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;
src/stdafx.h
Show inline comments
 
@@ -392,7 +392,7 @@ void NORETURN AssertFailedError(int line
 
/* 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
0 comments (0 inline, 0 general)