Cleanup: quiet ASAN warning initializing eWM_CapabilitiesFlag to -1

ASAN warns about this since moving wm_window.c to C++,
add an initialized flag instead of using an invalid value to
represent an uninitialized state.
This commit is contained in:
Campbell Barton 2023-07-24 12:39:06 +10:00
parent a82836b6c2
commit 5107fb6625
2 changed files with 5 additions and 3 deletions

View File

@ -173,6 +173,8 @@ typedef enum eWM_CapabilitiesFlag {
WM_CAPABILITY_GPU_FRONT_BUFFER_READ = (1 << 3),
/** Ability to copy/paste system clipboard images. */
WM_CAPABILITY_CLIPBOARD_IMAGES = (1 << 4),
/** The initial value, indicates the value needs to be set by inspecting GHOST. */
WM_CAPABILITY_INITIALIZED = (1 << 31),
} eWM_CapabilitiesFlag;
ENUM_OPERATORS(eWM_CapabilitiesFlag, WM_CAPABILITY_CLIPBOARD_IMAGES)

View File

@ -1866,11 +1866,11 @@ void wm_test_opengl_deprecation_warning(bContext *C)
eWM_CapabilitiesFlag WM_capabilities_flag()
{
static eWM_CapabilitiesFlag flag = eWM_CapabilitiesFlag(-1);
if (flag != -1) {
static eWM_CapabilitiesFlag flag = eWM_CapabilitiesFlag(0);
if (flag != 0) {
return flag;
}
flag = eWM_CapabilitiesFlag(0);
flag |= WM_CAPABILITY_INITIALIZED;
const GHOST_TCapabilityFlag ghost_flag = GHOST_GetCapabilities();
if (ghost_flag & GHOST_kCapabilityCursorWarp) {