From b60b77f7145bf60acb7d1f2b2e213404c6b3d2e3 Mon Sep 17 00:00:00 2001 From: Xiaoyi Zhang Date: Wed, 16 Nov 2022 18:13:09 -0500 Subject: [PATCH] Add `static` keyword to avoid -Wmissing-prototypes (#345) * Add `static` keyword to avoid -Wmissing-prototypes When compiling the code on mac catalyst (which uses IOS SDK), I ran into a compiler error with `-Werror -Wmissing-prototypes`. * changelog fragment Co-authored-by: Ryan Pavlik --- changes/sdk/pr.345.gh.OpenXR-SDK-Source.md | 1 + src/loader/loader_core.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changes/sdk/pr.345.gh.OpenXR-SDK-Source.md diff --git a/changes/sdk/pr.345.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.345.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..6cca89090 --- /dev/null +++ b/changes/sdk/pr.345.gh.OpenXR-SDK-Source.md @@ -0,0 +1 @@ +loader: Minor changes to fix a missing-prototypes warning/error. diff --git a/src/loader/loader_core.cpp b/src/loader/loader_core.cpp index a8bbfb4de..f2bc87d1f 100644 --- a/src/loader/loader_core.cpp +++ b/src/loader/loader_core.cpp @@ -35,7 +35,7 @@ // Global loader lock to: // 1. Ensure ActiveLoaderInstance get and set operations are done atomically. // 2. Ensure RuntimeInterface isn't used to unload the runtime while the runtime is in use. -std::mutex &GetGlobalLoaderMutex() { +static std::mutex &GetGlobalLoaderMutex() { static std::mutex loader_mutex; return loader_mutex; } @@ -58,6 +58,8 @@ static XRAPI_ATTR XrResult XRAPI_CALL LoaderXrTermDestroyDebugUtilsMessengerEXT( static XRAPI_ATTR XrResult XRAPI_CALL LoaderXrTermSubmitDebugUtilsMessageEXT( XrInstance instance, XrDebugUtilsMessageSeverityFlagsEXT messageSeverity, XrDebugUtilsMessageTypeFlagsEXT messageTypes, const XrDebugUtilsMessengerCallbackDataEXT *callbackData); +static XRAPI_ATTR XrResult XRAPI_CALL LoaderXrGetInstanceProcAddr(XrInstance instance, const char *name, + PFN_xrVoidFunction *function); // Utility template function meant to validate if a fixed size string contains // a null-terminator.