From 09f8f15d9066287dc2d593a424a67f52724faad4 Mon Sep 17 00:00:00 2001 From: Horatio Zhang Date: Sun, 29 Sep 2024 14:56:08 +0800 Subject: [PATCH] wsl/hsakmt: Ensure Immediate Output of Debug and Warning Messages Added fflush(stderr) to the WARN_ONCE and debug_print macros in utils.h to ensure that warning and debug messages are immediately flushed to the standard error stream. Signed-off-by: Horatio Zhang Reviewed-by: Flora Cui Part-of: --- util/utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/utils.h b/util/utils.h index 1aee7762a6..d65d3b0d2f 100644 --- a/util/utils.h +++ b/util/utils.h @@ -126,6 +126,7 @@ static __forceinline unsigned long long int strtoull(const char* str, if (!(exp) && (limit == 0 || count < limit)) { \ fprintf(stderr, "Warning: " STRING(exp) " in %s, " __FILE__ ":" STRING(__LINE__) "\n", \ __PRETTY_FUNCTION__); \ + fflush(stderr); \ count++; \ } \ } while (false) @@ -140,6 +141,7 @@ static __forceinline unsigned long long int strtoull(const char* str, #define debug_print(fmt, ...) \ do { \ fprintf(stderr, fmt, ##__VA_ARGS__); \ + fflush(stderr); \ } while (false) #endif