diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-02-19 00:32:13 +0000 |
---|---|---|
committer | Seth Jackson <sethjackson@gmail.com> | 2015-12-22 09:35:34 -0500 |
commit | c5d0c280d3d2bfa9e675ed6a4e3d8779c9f39977 (patch) | |
tree | 8a88c734ab07e4af03366f5a75688304a2413448 | |
parent | 376b973a0ae77243acdc15d1c786ea1f40aeb8a4 (diff) | |
download | rneovim-c5d0c280d3d2bfa9e675ed6a4e3d8779c9f39977.tar.gz rneovim-c5d0c280d3d2bfa9e675ed6a4e3d8779c9f39977.tar.bz2 rneovim-c5d0c280d3d2bfa9e675ed6a4e3d8779c9f39977.zip |
MSVC: Fix UI_CALL macro for MSVC.
The UI_CALL macro uses variadic macros and relies on the non standard
GCC extension. MSVC already applies similar behavior for the regular
__VA_ARGS__ removing the comma.
In MSVC UI_CALL can be implemented by calling UI_CALL_MORE directly.
-rw-r--r-- | src/nvim/ui.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 786f6026de..d32969f149 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -55,14 +55,25 @@ static int height, width; // // See http://stackoverflow.com/a/11172679 for a better explanation of how it // works. -#define UI_CALL(...) \ - do { \ - flush_cursor_update(); \ - for (size_t i = 0; i < ui_count; i++) { \ - UI *ui = uis[i]; \ - UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \ - } \ - } while (0) +#ifdef _MSC_VER + #define UI_CALL(funname, ...) \ + do { \ + flush_cursor_update(); \ + for (size_t i = 0; i < ui_count; i++) { \ + UI *ui = uis[i]; \ + UI_CALL_MORE(funname, __VA_ARGS__); \ + } \ + } while (0) +#else + #define UI_CALL(...) \ + do { \ + flush_cursor_update(); \ + for (size_t i = 0; i < ui_count; i++) { \ + UI *ui = uis[i]; \ + UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \ + } \ + } while (0) +#endif #define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore) #define SELECT_NTH(a1, a2, a3, a4, a5, a6, ...) a6 #define UI_CALL_HELPER(c, ...) UI_CALL_HELPER2(c, __VA_ARGS__) |