mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 11:56:30 +00:00
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.
This commit is contained in:

committed by
Seth Jackson

parent
376b973a0a
commit
c5d0c280d3
@@ -55,7 +55,17 @@ static int height, width;
|
|||||||
//
|
//
|
||||||
// See http://stackoverflow.com/a/11172679 for a better explanation of how it
|
// See http://stackoverflow.com/a/11172679 for a better explanation of how it
|
||||||
// works.
|
// works.
|
||||||
#define UI_CALL(...) \
|
#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 { \
|
do { \
|
||||||
flush_cursor_update(); \
|
flush_cursor_update(); \
|
||||||
for (size_t i = 0; i < ui_count; i++) { \
|
for (size_t i = 0; i < ui_count; i++) { \
|
||||||
@@ -63,6 +73,7 @@ static int height, width;
|
|||||||
UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
|
UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#endif
|
||||||
#define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore)
|
#define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore)
|
||||||
#define SELECT_NTH(a1, a2, a3, a4, a5, a6, ...) a6
|
#define SELECT_NTH(a1, a2, a3, a4, a5, a6, ...) a6
|
||||||
#define UI_CALL_HELPER(c, ...) UI_CALL_HELPER2(c, __VA_ARGS__)
|
#define UI_CALL_HELPER(c, ...) UI_CALL_HELPER2(c, __VA_ARGS__)
|
||||||
|
Reference in New Issue
Block a user