Skip to content

Commit

Permalink
Fix Macro warning for empty __VA_ARGS__
Browse files Browse the repository at this point in the history
  • Loading branch information
mnesarco committed Jul 9, 2021
1 parent 2a43232 commit b1ef628
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion imgui_sugar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace ImGuiSugar

// Portable Expression Statement, calls void function and returns true
#define _IMGUI_SUGAR_ES(FN, ...) ([&]() -> bool { FN(__VA_ARGS__); return true; }())
#define _IMGUI_SUGAR_ES_0(FN) ([&]() -> bool { FN(); return true; }())

// Concatenating symbols with __LINE__ requires two levels of indirection
#define _IMGUI_SUGAR_CONCAT0(A, B) A ## B
Expand All @@ -85,7 +86,7 @@ namespace ImGuiSugar
if (const ImGuiSugar::BooleanGuard<true> _ui_scope_guard = {_IMGUI_SUGAR_ES(ImGui::BEGIN, __VA_ARGS__), &ImGui::END})

#define _IMGUI_SUGAR_SCOPED_VOID_0(BEGIN, END) \
if (const ImGuiSugar::BooleanGuard<true> _ui_scope_guard = {_IMGUI_SUGAR_ES(ImGui::BEGIN), &ImGui::END})
if (const ImGuiSugar::BooleanGuard<true> _ui_scope_guard = {_IMGUI_SUGAR_ES_0(ImGui::BEGIN), &ImGui::END})

#define _IMGUI_SUGAR_PARENT_SCOPED_VOID_N(BEGIN, END, ...) \
const ImGuiSugar::BooleanGuard<true> _IMGUI_SUGAR_CONCAT1(_ui_scope_, __LINE__) = {_IMGUI_SUGAR_ES(ImGui::BEGIN, __VA_ARGS__), &ImGui::END}
Expand Down

0 comments on commit b1ef628

Please sign in to comment.