浏览代码

Speculative va_copy() fix for old versions of GCC/Clang. (cannot repro) (#1085)

omar 7 年之前
父节点
当前提交
80db2383d8
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      imgui.cpp

+ 4 - 0
imgui.cpp

@@ -1931,8 +1931,12 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const
 // On some platform vsnprintf() takes va_list by reference and modifies it.
 // On some platform vsnprintf() takes va_list by reference and modifies it.
 // va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.
 // va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.
 #ifndef va_copy
 #ifndef va_copy
+#if defined(__GNUC__) || defined(__clang__)
+#define va_copy(dest, src) __builtin_va_copy(dest, src)
+#else
 #define va_copy(dest, src) (dest = src)
 #define va_copy(dest, src) (dest = src)
 #endif
 #endif
+#endif
 
 
 // Helper: Text buffer for logging/accumulating text
 // Helper: Text buffer for logging/accumulating text
 void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
 void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)