From ae73a263551b7eae1b0182e991b2a309835acd6c Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 21 Mar 2022 11:43:54 +0100 Subject: [PATCH] util: limit error-dialogs to win32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These dialogs only exist on Windows, so let's not even expose a util function for this on other platforms. The code is only ever called from Windows specific code anyway. While we're at it, clean up the name a bit as well. Reviewed-by: Louis-Francis Ratté-Boulianne Reviewed-by: Jesse Natalie Part-of: --- src/gallium/frontends/wgl/stw_device.c | 2 +- src/util/u_debug.c | 8 ++++---- src/util/u_debug.h | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gallium/frontends/wgl/stw_device.c b/src/gallium/frontends/wgl/stw_device.c index 52acb9e5c63..0ef057bce2f 100644 --- a/src/gallium/frontends/wgl/stw_device.c +++ b/src/gallium/frontends/wgl/stw_device.c @@ -120,7 +120,7 @@ stw_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; - debug_disable_error_message_boxes(); + debug_disable_win32_error_dialogs(); assert(!stw_dev); diff --git a/src/util/u_debug.c b/src/util/u_debug.c index 9c18928f82b..e5101bf431a 100644 --- a/src/util/u_debug.c +++ b/src/util/u_debug.c @@ -75,10 +75,10 @@ _util_debug_message(struct util_debug_callback *cb, } -void -debug_disable_error_message_boxes(void) -{ #ifdef _WIN32 +void +debug_disable_win32_error_dialogs(void) +{ /* When Windows' error message boxes are disabled for this process (as is * typically the case when running tests in an automated fashion) we disable * CRT message boxes too. @@ -97,8 +97,8 @@ debug_disable_error_message_boxes(void) _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); #endif } -#endif /* _WIN32 */ } +#endif /* _WIN32 */ #ifdef DEBUG diff --git a/src/util/u_debug.h b/src/util/u_debug.h index c8e2f3dbfbf..9c4a4cfd091 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -177,13 +177,15 @@ void debug_print_blob( const char *name, const void *blob, unsigned size ); #endif +#ifdef _WIN32 /** - * Disable interactive error message boxes. + * Disable Win32 interactive error message boxes. * * Should be called as soon as possible for effectiveness. */ void -debug_disable_error_message_boxes(void); +debug_disable_win32_error_dialogs(void); +#endif /**