diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-03-16 07:34:27 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-03-18 14:30:05 +0100 |
commit | 26b84a8b3e99d9dce2ad9f34e1663f119cd1c558 (patch) | |
tree | 935c0efc48128a409cdf428337bf9635b20b633d | |
parent | 960f09362539a65bedebe2d4e4a878546df66273 (diff) | |
download | rneovim-26b84a8b3e99d9dce2ad9f34e1663f119cd1c558.tar.gz rneovim-26b84a8b3e99d9dce2ad9f34e1663f119cd1c558.tar.bz2 rneovim-26b84a8b3e99d9dce2ad9f34e1663f119cd1c558.zip |
build/MSVC: fix "C4003: not enough actual parameters for macro"
For the case of TV_DICTITEM_STRUCT, we can't just pass `1` because:
https://github.com/neovim/neovim/pull/8142#discussion_r175262436
> this variant will trigger array overrun warnings from various static analyzers.
-rw-r--r-- | src/nvim/api/private/helpers.c | 2 | ||||
-rw-r--r-- | src/nvim/eval/typval.h | 4 | ||||
-rw-r--r-- | src/nvim/lua/converter.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 65c306d4b1..1115faaeaf 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -567,7 +567,7 @@ static inline void typval_encode_dict_end(EncodedData *const edata) typval_encode_dict_end(edata) #define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \ - TYPVAL_ENCODE_CONV_NIL() + TYPVAL_ENCODE_CONV_NIL(val) #define TYPVAL_ENCODE_SCOPE static #define TYPVAL_ENCODE_NAME object diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 40a1738d9e..2272a580d6 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -206,11 +206,11 @@ struct dictitem_S { char_u di_key[1]; ///< key (actually longer!) }; -#define TV_DICTITEM_STRUCT(KEY_LEN) \ +#define TV_DICTITEM_STRUCT(...) \ struct { \ typval_T di_tv; /* Structure that holds scope dictionary itself. */ \ uint8_t di_flags; /* Flags. */ \ - char_u di_key[KEY_LEN]; /* Key value. */ \ + char_u di_key[__VA_ARGS__]; /* Key value. */ \ } /// Structure to hold a scope dictionary diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c index 9e3063b164..5da6d2c0a0 100644 --- a/src/nvim/lua/converter.c +++ b/src/nvim/lua/converter.c @@ -423,7 +423,7 @@ nlua_pop_typval_table_processing_end: #define TYPVAL_ENCODE_CONV_STR_STRING TYPVAL_ENCODE_CONV_STRING #define TYPVAL_ENCODE_CONV_EXT_STRING(tv, str, len, type) \ - TYPVAL_ENCODE_CONV_NIL() + TYPVAL_ENCODE_CONV_NIL(tv) #define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \ do { \ |