Browse Source

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

amended for gcc/clang warnings
amended to facilitate merge with docking
features/string_view
ocornut 2 years ago
parent
commit
ca24d56873
  1. 18
      imgui.h

18
imgui.h

@ -134,6 +134,7 @@ Index of this file:
#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx'
#pragma clang diagnostic ignored "-Wold-style-cast"
#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"
#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
@ -1076,6 +1077,23 @@ 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
//-----------------------------------------------------------------------------

Loading…
Cancel
Save