1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-18 18:46:13 +01:00

ImStrv: add needed disambiguishing functions for const char* now being ambiguous. (5079)

amended for gcc/clang warnings
amended to facilitate merge with docking
This commit is contained in:
ocornut 2022-09-29 22:51:33 +02:00 committed by ocornut
parent 8c29abb70a
commit 9fa0a03e4f

18
imgui.h
View File

@ -134,6 +134,7 @@ Index of this file:
#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx' #pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx'
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast #pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
#pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe #pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe
#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning: format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning: zero as null pointer constant
#pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter #pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access
@ -1077,6 +1078,23 @@ namespace ImGui
} // namespace ImGui } // namespace ImGui
namespace ImGui
{
// FIXME-IMSTR
// Functions which could accept both 'const char*' and 'const void*' now have an ambiguity between 'ImStrv' and 'const void*' when passed literals.
// Binding generators would likely need to ignore those.
// See https://github.com/ocornut/imgui/issues/5079
IM_MSVC_RUNTIME_CHECKS_OFF
inline void PushID(const char* str_id) { PushID(ImStrv(str_id)); }
inline ImGuiID GetID(const char* str_id) { return GetID(ImStrv(str_id)); }
inline IM_FMTARGS(2) bool TreeNode(const char* str_id, const char* fmt, ...) { va_list args; va_start(args, fmt); bool ret = TreeNodeV(ImStrv(str_id), fmt, args); va_end(args); return ret; }
inline IM_FMTLIST(2) bool TreeNodeV(const char* str_id, const char* fmt, va_list args) { return TreeNodeV(ImStrv(str_id), fmt, args); }
inline IM_FMTARGS(3) bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) { va_list args; va_start(args, fmt); bool ret = TreeNodeExV(ImStrv(str_id), flags, fmt, args); va_end(args); return ret; }
inline IM_FMTLIST(3) bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) { return TreeNodeEx(ImStrv(str_id), flags, fmt, args); }
inline void TreePush(const char* str_id) { TreePush(ImStrv(str_id)); }
IM_MSVC_RUNTIME_CHECKS_RESTORE
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// [SECTION] Flags & Enumerations // [SECTION] Flags & Enumerations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------