vim-patch:8.2.4639: not sufficient parenthesis in preprocessor macros

Problem:    Not sufficient parenthesis in preprocessor macros.
Solution:   Add more parenthesis.
9dac9b1751
This commit is contained in:
Brian Leung 2022-04-03 01:37:28 -07:00
parent d73bf3138a
commit 271bb32855
No known key found for this signature in database
GPG Key ID: 3ADC75F013D678F9
15 changed files with 28 additions and 28 deletions

View File

@ -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,
};

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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... */

View File

@ -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, };

View File

@ -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);

View File

@ -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)))

View File

@ -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

View File

@ -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.

View File

@ -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'.

View File

@ -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"

View File

@ -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.

View File

@ -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;

View File

@ -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