From b7cb3d93a419ffa9c37c2150eda695f3f43c221f Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 3 Sep 2025 19:39:55 +0200 Subject: [PATCH] Comments about using MSVC SAL for printf annotation. (#8871) --- imgui.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imgui.h b/imgui.h index 12f01f43f..859cb0318 100644 --- a/imgui.h +++ b/imgui.h @@ -100,8 +100,10 @@ Index of this file: #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) // Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions. -// (MSVC provides an equivalent mechanism via SAL Annotations but it would require the macros in a different -// location. e.g. #include + void myprintf(_Printf_format_string_ const char* format, ...)) +// (MSVC provides an equivalent mechanism via SAL Annotations but it requires the macros in a different +// location. e.g. #include + void myprintf(_Printf_format_string_ const char* format, ...), +// and only works when using Code Analysis, rather than just normal compiling). +// (see https://github.com/ocornut/imgui/issues/8871 for a patch to enable this for MSVC's Code Analysis) #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__) #define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1))) #define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))