diff options
author | Brian Leung <leungbk@posteo.net> | 2022-04-03 01:37:28 -0700 |
---|---|---|
committer | Brian Leung <leungbk@posteo.net> | 2022-04-03 15:57:07 -0700 |
commit | 271bb32855853b011fceaf0ad2f829bce66b2a19 (patch) | |
tree | a13efbe2922f6d5beccee30631ffdfe5f38aa90a | |
parent | d73bf3138a802bb6c1c654cd913d4e91932287f8 (diff) | |
download | rneovim-271bb32855853b011fceaf0ad2f829bce66b2a19.tar.gz rneovim-271bb32855853b011fceaf0ad2f829bce66b2a19.tar.bz2 rneovim-271bb32855853b011fceaf0ad2f829bce66b2a19.zip |
vim-patch:8.2.4639: not sufficient parenthesis in preprocessor macros
Problem: Not sufficient parenthesis in preprocessor macros.
Solution: Add more parenthesis.
https://github.com/vim/vim/commit/9dac9b1751dd43c02470cc6a2aecaeea27abcc80
-rw-r--r-- | src/nvim/buffer.h | 2 | ||||
-rw-r--r-- | src/nvim/buffer_defs.h | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/nvim/ex_cmds_defs.h | 4 | ||||
-rw-r--r-- | src/nvim/fileio.c | 2 | ||||
-rw-r--r-- | src/nvim/getchar.h | 4 | ||||
-rw-r--r-- | src/nvim/globals.h | 8 | ||||
-rw-r--r-- | src/nvim/macros.h | 2 | ||||
-rw-r--r-- | src/nvim/mouse.h | 4 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 4 | ||||
-rw-r--r-- | src/nvim/regexp_defs.h | 2 | ||||
-rw-r--r-- | src/nvim/screen.h | 4 | ||||
-rw-r--r-- | src/nvim/spell_defs.h | 6 | ||||
-rw-r--r-- | src/nvim/syntax_defs.h | 2 | ||||
-rw-r--r-- | src/nvim/vim.h | 6 |
15 files changed, 28 insertions, 28 deletions
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 9e2ca999e4..850ab175a5 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -23,7 +23,7 @@ enum getf_retvalues { GETFILE_ERROR = 1, // normal error GETFILE_NOT_WRITTEN = 2, // "not written" error GETFILE_SAME_FILE = 0, // success, same file - GETFILE_OPEN_OTHER = -1, // success, opened another file + GETFILE_OPEN_OTHER = (-1), // success, opened another file GETFILE_UNUSED = 8, }; diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 08ca1a6247..422741cc2f 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -661,7 +661,7 @@ struct file_buffer { // flags for use of ":lmap" and IM control long b_p_iminsert; // input mode for insert long b_p_imsearch; // input mode for search -#define B_IMODE_USE_INSERT -1 // Use b_p_iminsert value for search +#define B_IMODE_USE_INSERT (-1) // Use b_p_iminsert value for search #define B_IMODE_NONE 0 // Input via none #define B_IMODE_LMAP 1 // Input via langmap #define B_IMODE_LAST 1 @@ -1420,7 +1420,7 @@ struct window_S { int w_briopt_list; // additional indent for lists // transform a pointer to a "onebuf" option into a "allbuf" option -#define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) +#define GLOBAL_WO(p) ((char *)(p) + sizeof(winopt_T)) long w_scbind_pos; diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h index 241674c24c..1c95b75001 100644 --- a/src/nvim/ex_cmds.h +++ b/src/nvim/ex_cmds.h @@ -21,7 +21,7 @@ // for lnum argument in do_ecmd() #define ECMD_LASTL (linenr_T)0 // use last position in loaded file -#define ECMD_LAST (linenr_T)-1 // use last position in all files +#define ECMD_LAST ((linenr_T)-1) // use last position in all files #define ECMD_ONE (linenr_T)1 // use first line /// Previous :substitute replacement string definition diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 92675499be..39dfc1b94c 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -87,8 +87,8 @@ typedef struct exarg exarg_T; // behavior for bad character, "++bad=" argument #define BAD_REPLACE '?' // replace it with '?' (default) -#define BAD_KEEP -1 // leave it -#define BAD_DROP -2 // erase it +#define BAD_KEEP (-1) // leave it +#define BAD_DROP (-2) // erase it typedef void (*ex_func_T)(exarg_T *eap); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 5e11a9683e..64ad9a6d80 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -80,7 +80,7 @@ #define FIO_ENDIAN_L 0x80 // little endian #define FIO_NOCONVERT 0x2000 // skip encoding conversion #define FIO_UCSBOM 0x4000 // check for BOM at start of file -#define FIO_ALL -1 // allow all formats +#define FIO_ALL (-1) // allow all formats /* When converting, a read() or write() may leave some bytes to be converted * for the next call. The value is guessed... */ diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h index f24a4e7c7c..9b8605f1df 100644 --- a/src/nvim/getchar.h +++ b/src/nvim/getchar.h @@ -61,8 +61,8 @@ typedef struct map_arguments MapArguments; #define MAP_ARGUMENTS_INIT { false, false, false, false, false, false, false, \ { 0 }, 0, NULL, 0, LUA_NOREF, false, NULL, 0, NULL } -#define KEYLEN_PART_KEY -1 // keylen value for incomplete key-code -#define KEYLEN_PART_MAP -2 // keylen value for incomplete mapping +#define KEYLEN_PART_KEY (-1) // keylen value for incomplete key-code +#define KEYLEN_PART_MAP (-2) // keylen value for incomplete mapping /// Maximum number of streams to read script from enum { NSCRIPT = 15, }; diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 605a2183f3..ace7647b35 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -430,7 +430,7 @@ EXTERN win_T *lastwin; // last window EXTERN win_T *prevwin INIT(= NULL); // previous window #define ONE_WINDOW (firstwin == lastwin) #define FOR_ALL_FRAMES(frp, first_frame) \ - for (frp = first_frame; frp != NULL; frp = frp->fr_next) // NOLINT + for ((frp) = first_frame; (frp) != NULL; (frp) = (frp)->fr_next) // NOLINT // When using this macro "break" only breaks out of the inner loop. Use "goto" // to break out of the tabpage loop. @@ -461,7 +461,7 @@ EXTERN tabpage_T *lastused_tabpage; EXTERN bool redraw_tabline INIT(= false); // need to redraw tabline // Iterates over all tabs in the tab list -#define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) +#define FOR_ALL_TABS(tp) for (tabpage_T *(tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) // All buffers are linked in a list. 'firstbuf' points to the first entry, // 'lastbuf' to the last entry and 'curbuf' to the currently active buffer. @@ -477,7 +477,7 @@ EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer // Iterate through all the signs placed in a buffer #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \ - for (sign = buf->b_signlist; sign != NULL; sign = sign->se_next) // NOLINT + for ((sign) = (buf)->b_signlist; (sign) != NULL; (sign) = (sign)->se_next) // NOLINT // List of files being edited (global argument list). curwin->w_alist points @@ -618,7 +618,7 @@ EXTERN int inhibit_delete_count INIT(= 0); #define DBCS_CHT 950 // taiwan #define DBCS_CHTU 9950 // euc-tw #define DBCS_2BYTE 1 // 2byte- -#define DBCS_DEBUG -1 +#define DBCS_DEBUG (-1) /// Encoding used when 'fencs' is set to "default" EXTERN char_u *fenc_default INIT(= NULL); diff --git a/src/nvim/macros.h b/src/nvim/macros.h index d5611f587b..5017e286d3 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -103,7 +103,7 @@ // MB_PTR_BACK(): backup a pointer to the previous character, taking care of // multi-byte characters if needed. Only use with "p" > "s" ! #define MB_PTR_BACK(s, p) \ - (p -= utf_head_off((char_u *)s, (char_u *)p - 1) + 1) + (p -= utf_head_off((char_u *)(s), (char_u *)(p) - 1) + 1) // MB_CHAR2BYTES(): convert character to bytes and advance pointer to bytes #define MB_CHAR2BYTES(c, b) ((b) += utf_char2bytes((c), (b))) diff --git a/src/nvim/mouse.h b/src/nvim/mouse.h index bf4f9c57e5..04acb88bb3 100644 --- a/src/nvim/mouse.h +++ b/src/nvim/mouse.h @@ -38,8 +38,8 @@ // Direction for nv_mousescroll() and ins_mousescroll() #define MSCR_DOWN 0 // DOWN must be FALSE #define MSCR_UP 1 -#define MSCR_LEFT -1 -#define MSCR_RIGHT -2 +#define MSCR_LEFT (-1) +#define MSCR_RIGHT (-2) #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 98c2b84770..6ce95ea690 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -57,7 +57,7 @@ #define ENC_DFLT "utf-8" // end-of-line style -#define EOL_UNKNOWN -1 // not defined yet +#define EOL_UNKNOWN (-1) // not defined yet #define EOL_UNIX 0 // NL #define EOL_DOS 1 // CR NL #define EOL_MAC 2 // CR @@ -899,7 +899,7 @@ enum { }; // Value for b_p_ul indicating the global value must be used. -#define NO_LOCAL_UNDOLEVEL -123456 +#define NO_LOCAL_UNDOLEVEL (-123456) #define SB_MAX 100000 // Maximum 'scrollback' value. diff --git a/src/nvim/regexp_defs.h b/src/nvim/regexp_defs.h index 1d112bd64a..913cfb2074 100644 --- a/src/nvim/regexp_defs.h +++ b/src/nvim/regexp_defs.h @@ -34,7 +34,7 @@ // In the NFA engine: how many states are allowed. #define NFA_MAX_STATES 100000 -#define NFA_TOO_EXPENSIVE -1 +#define NFA_TOO_EXPENSIVE (-1) // Which regexp engine to use? Needed for vim_regcomp(). // Must match with 'regexpengine'. diff --git a/src/nvim/screen.h b/src/nvim/screen.h index d15e4b7e45..5e86dacd25 100644 --- a/src/nvim/screen.h +++ b/src/nvim/screen.h @@ -65,8 +65,8 @@ extern StlClickDefinition *tab_page_click_defs; /// Size of the tab_page_click_defs array extern long tab_page_click_defs_size; -#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -#define W_ENDROW(wp) (wp->w_winrow + wp->w_height) +#define W_ENDCOL(wp) ((wp)->w_wincol + (wp)->w_width) +#define W_ENDROW(wp) ((wp)->w_winrow + (wp)->w_height) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "screen.h.generated.h" diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h index 220f51cd2f..12e44cb7ff 100644 --- a/src/nvim/spell_defs.h +++ b/src/nvim/spell_defs.h @@ -93,9 +93,9 @@ typedef int salfirst_T; // Values for SP_*ERROR are negative, positive values are used by // read_cnt_string(). -#define SP_TRUNCERROR -1 // spell file truncated error -#define SP_FORMERROR -2 // format error in spell file -#define SP_OTHERERROR -3 // other error while reading spell file +#define SP_TRUNCERROR (-1) // spell file truncated error +#define SP_FORMERROR (-2) // format error in spell file +#define SP_OTHERERROR (-3) // other error while reading spell file // Structure used to store words and other info for one language, loaded from // a .spl file. diff --git a/src/nvim/syntax_defs.h b/src/nvim/syntax_defs.h index a005f67209..c656f21181 100644 --- a/src/nvim/syntax_defs.h +++ b/src/nvim/syntax_defs.h @@ -7,7 +7,7 @@ #define SST_MAX_ENTRIES 1000 // maximal size for state stack array #define SST_FIX_STATES 7 // size of sst_stack[]. #define SST_DIST 16 // normal distance between entries -#define SST_INVALID (synstate_T *)-1 // invalid syn_state pointer +#define SST_INVALID ((synstate_T *)-1) // invalid syn_state pointer typedef struct syn_state synstate_T; diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 5d632b1b25..f65dd4f0d4 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -264,7 +264,7 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() // Prefer using semsg(), because perror() may send the output to the wrong // destination and mess up the screen. -#define PERROR(msg) (void)semsg("%s: %s", msg, strerror(errno)) +#define PERROR(msg) (void)semsg("%s: %s", (msg), strerror(errno)) #define SHOWCMD_COLS 10 // columns needed by shown command @@ -319,7 +319,7 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() #endif // Replacement for nchar used by nv_replace(). -#define REPLACE_CR_NCHAR -1 -#define REPLACE_NL_NCHAR -2 +#define REPLACE_CR_NCHAR (-1) +#define REPLACE_NL_NCHAR (-2) #endif // NVIM_VIM_H |