0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1454: code indenting is confused by macros

Problem:    Code indenting is confused by macros.
Solution:   Put semicolon after the macros instead of inside. (Ozaki Kiichi,
            closes #12257)
This commit is contained in:
ichizok
2023-04-15 13:17:50 +01:00
committed by Bram Moolenaar
parent b49dfd0cf2
commit 7e5fe38efc
10 changed files with 66 additions and 56 deletions

View File

@@ -366,21 +366,31 @@
#ifdef ABORT_ON_INTERNAL_ERROR
# define ESTACK_CHECK_DECLARATION int estack_len_before;
# define ESTACK_CHECK_SETUP estack_len_before = exestack.ga_len;
# define ESTACK_CHECK_NOW if (estack_len_before != exestack.ga_len) \
siemsg("Exestack length expected: %d, actual: %d", estack_len_before, exestack.ga_len);
# define CHECK_CURBUF if (curwin != NULL && curwin->w_buffer != curbuf) \
iemsg("curbuf != curwin->w_buffer")
# define ESTACK_CHECK_DECLARATION int estack_len_before
# define ESTACK_CHECK_SETUP do { estack_len_before = exestack.ga_len; } while (0)
# define ESTACK_CHECK_NOW \
do { \
if (estack_len_before != exestack.ga_len) \
siemsg("Exestack length expected: %d, actual: %d", estack_len_before, exestack.ga_len); \
} while (0)
# define CHECK_CURBUF \
do { \
if (curwin != NULL && curwin->w_buffer != curbuf) \
iemsg("curbuf != curwin->w_buffer"); \
} while (0)
#else
# define ESTACK_CHECK_DECLARATION
# define ESTACK_CHECK_SETUP
# define ESTACK_CHECK_NOW
# define CHECK_CURBUF
# define ESTACK_CHECK_DECLARATION do { /**/ } while (0)
# define ESTACK_CHECK_SETUP do { /**/ } while (0)
# define ESTACK_CHECK_NOW do { /**/ } while (0)
# define CHECK_CURBUF do { /**/ } while (0)
#endif
// Inline the condition for performance.
#define CHECK_LIST_MATERIALIZE(l) if ((l)->lv_first == &range_list_item) range_list_materialize(l)
#define CHECK_LIST_MATERIALIZE(l) \
do { \
if ((l)->lv_first == &range_list_item) \
range_list_materialize(l); \
} while (0)
// Inlined version of ga_grow() with optimized condition that it fails.
#define GA_GROW_FAILS(gap, n) unlikely((((gap)->ga_maxlen - (gap)->ga_len < (n)) ? ga_grow_inner((gap), (n)) : OK) == FAIL)