From deba3bf6bb9fe318409426b4f121d1058c3c6321 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Tue, 20 Jun 2023 18:34:04 +0200 Subject: [PATCH] Fix some missing field initializer warnings The code was actually initializing the fields after the struct initialization but the compiler is not smart enough to acknowledge that. Explicitly initialize the fields one by one to remove the warnings. --- changes/sdk/pr.410.gh.OpenXR-SDK-Source.md | 1 + src/loader/loader_logger_recorders.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changes/sdk/pr.410.gh.OpenXR-SDK-Source.md diff --git a/changes/sdk/pr.410.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.410.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..4a73dd19e --- /dev/null +++ b/changes/sdk/pr.410.gh.OpenXR-SDK-Source.md @@ -0,0 +1 @@ +loader: Fix some warnings. diff --git a/src/loader/loader_logger_recorders.cpp b/src/loader/loader_logger_recorders.cpp index 1b3892b89..1c6f415ca 100644 --- a/src/loader/loader_logger_recorders.cpp +++ b/src/loader/loader_logger_recorders.cpp @@ -160,13 +160,15 @@ bool DebugUtilsLogRecorder::LogMessage(XrLoaderLogMessageSeverityFlagBits messag XrDebugUtilsMessageTypeFlagsEXT utils_type = LoaderLogMessageTypesToDebugUtilsMessageTypes(message_type); // Convert the loader log message into the debug utils log message information - XrDebugUtilsMessengerCallbackDataEXT utils_callback_data = {XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT}; + XrDebugUtilsMessengerCallbackDataEXT utils_callback_data; + utils_callback_data.type = XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; utils_callback_data.messageId = callback_data->message_id; utils_callback_data.functionName = callback_data->command_name; utils_callback_data.message = callback_data->message; - std::vector utils_objects(callback_data->object_count, - {XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT}); + std::vector utils_objects(callback_data->object_count); for (uint8_t object = 0; object < callback_data->object_count; ++object) { + utils_objects[object].type = XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + utils_objects[object].next = nullptr; utils_objects[object].objectHandle = callback_data->objects[object].handle; utils_objects[object].objectType = callback_data->objects[object].type; utils_objects[object].objectName = callback_data->objects[object].name.c_str();