diff --git a/CMakeLists.txt b/CMakeLists.txt index 949de8487d..cadab62ce6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,8 +280,7 @@ add_glob_target( FLAGS -q GLOB_DIRS runtime/ scripts/ src/ test/ GLOB_PAT *.lua - TOUCH_STRATEGY SINGLE - ) + TOUCH_STRATEGY SINGLE) add_glob_target( TARGET lintlua-stylua @@ -289,8 +288,7 @@ add_glob_target( FLAGS --color=always --check GLOB_DIRS runtime/ GLOB_PAT *.lua - TOUCH_STRATEGY SINGLE - ) + TOUCH_STRATEGY SINGLE) add_custom_target(lintlua) add_dependencies(lintlua lintlua-luacheck lintlua-stylua) @@ -305,8 +303,7 @@ add_glob_target( scripts/pvscheck.sh ci/common ci/snap - TOUCH_STRATEGY SINGLE - ) + TOUCH_STRATEGY SINGLE) add_custom_target(lintcommit COMMAND ${PROJECT_BINARY_DIR}/bin/nvim -u NONE -es -c [[lua require('scripts.lintcommit').main({trace=false})]] @@ -315,7 +312,7 @@ add_custom_target(lintcommit add_dependencies(lintcommit nvim) add_custom_target(lint) -add_dependencies(lint check-single-includes lintc lintlua lintsh lintcommit lintuncrustify) +add_dependencies(lint check-single-includes lintc lintlua lintsh lintcommit) # # Format diff --git a/Makefile b/Makefile index a29fa57e75..110e9e3760 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ src/nvim/testdir/%.vim: phony_force functionaltest functionaltest-lua unittest benchmark: | nvim $(BUILD_TOOL) -C build $@ -lintlua lintsh lintuncrustify lintc lintcfull check-single-includes generated-sources lintcommit lint formatc formatlua format: | build/.ran-cmake +lintlua lintsh lintc check-single-includes generated-sources lintcommit lint formatc formatlua format: | build/.ran-cmake $(CMAKE_PRG) --build build --target $@ test: functionaltest unittest diff --git a/cmake/Download.cmake b/cmake/Download.cmake deleted file mode 100644 index 50a77816bc..0000000000 --- a/cmake/Download.cmake +++ /dev/null @@ -1,18 +0,0 @@ -file( - DOWNLOAD "${URL}" "${FILE}" - STATUS status - LOG log -) - -list(GET status 0 status_code) -list(GET status 1 status_string) - -if(NOT status_code EQUAL 0) - if(NOT ALLOW_FAILURE) - message(FATAL_ERROR "error: downloading '${URL}' failed - status_code: ${status_code} - status_string: ${status_string} - log: ${log} - ") - endif() -endif() diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 1d7724f8be..a479ae4d1c 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -379,16 +379,6 @@ set(LUA_FILETYPE_MODULE_SOURCE ${PROJECT_SOURCE_DIR}/runtime/lua/vim/filetype.lu set(LUA_INIT_PACKAGES_MODULE_SOURCE ${PROJECT_SOURCE_DIR}/runtime/lua/vim/_init_packages.lua) set(LUA_KEYMAP_MODULE_SOURCE ${PROJECT_SOURCE_DIR}/runtime/lua/vim/keymap.lua) set(CHAR_BLOB_GENERATOR ${GENERATOR_DIR}/gen_char_blob.lua) -set(LINT_SUPPRESS_FILE ${PROJECT_BINARY_DIR}/errors.json) -set(LINT_SUPPRESS_URL_BASE "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint") -set(LINT_SUPPRESS_URL "${LINT_SUPPRESS_URL_BASE}/errors.json") -set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py) -set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake) -set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors) -set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz") -set(LINT_SUPPRESSES_ARCHIVE ${LINT_SUPPRESSES_ROOT}/errors.tar.gz) -set(LINT_SUPPRESSES_TOUCH_FILE "${TOUCHES_DIR}/unpacked-clint-errors-archive") -set(CLINT_REPORT_PATH ${LINT_SUPPRESSES_ROOT}/src/home/runner/work/doc/doc/gh-pages/reports/clint) glob_wrapper(UNICODE_FILES ${UNICODE_DIR}/*.txt) glob_wrapper(API_HEADERS api/*.h) @@ -404,8 +394,6 @@ target_include_directories(main_lib INTERFACE "${PROJECT_SOURCE_DIR}/src") file(MAKE_DIRECTORY ${TOUCHES_DIR}) file(MAKE_DIRECTORY ${GENERATED_DIR}) file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}) -file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}) -file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src) glob_wrapper(NVIM_SOURCES *.c) glob_wrapper(NVIM_HEADERS *.h) @@ -976,55 +964,17 @@ foreach(hfile ${NVIM_HEADERS}) endforeach() add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS}) -function(add_download output url allow_failure) - add_custom_command( - OUTPUT "${output}" - COMMAND - ${CMAKE_COMMAND} - -DURL=${url} -DFILE=${output} - -DALLOW_FAILURE=${allow_failure} - -P ${DOWNLOAD_SCRIPT} - DEPENDS ${DOWNLOAD_SCRIPT} - ) -endfunction() - -add_download(${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_URL} off) - -add_custom_command( - OUTPUT ${LINT_SUPPRESSES_TOUCH_FILE} - WORKING_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src - COMMAND ${CMAKE_COMMAND} -E tar xfz ${LINT_SUPPRESSES_ARCHIVE} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CLINT_REPORT_PATH} "${LINT_SUPPRESSES_ROOT}" - COMMAND ${CMAKE_COMMAND} -E touch ${LINT_SUPPRESSES_TOUCH_FILE} - DEPENDS ${LINT_SUPPRESSES_ARCHIVE} -) - -add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off) - if(CI_BUILD) set(LINT_OUTPUT_FORMAT gh_action) else() set(LINT_OUTPUT_FORMAT vs7) endif() -set(LINT_NVIM_REL_SOURCES) -foreach(sfile ${LINT_NVIM_SOURCES}) - get_test_target("" "${sfile}" r suffix) - set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json) - set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json") - set(rsfile src/nvim/${r}) - set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}") - add_custom_command( - OUTPUT ${touch_file} - COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} --output=${LINT_OUTPUT_FORMAT} ${rsfile} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} - DEPENDS ${LINT_PRG} ${sfile} ${LINT_SUPPRESSES_TOUCH_FILE} - ) - list(APPEND LINT_TARGETS ${touch_file}) - list(APPEND LINT_NVIM_REL_SOURCES ${rsfile}) -endforeach() -add_custom_target(lintc DEPENDS ${LINT_TARGETS}) +add_glob_target( + TARGET lintc-clint + COMMAND ${PROJECT_SOURCE_DIR}/src/clint.py + FLAGS --output=${LINT_OUTPUT_FORMAT} + FILES ${LINT_NVIM_SOURCES}) add_custom_target(uncrustify-version COMMAND ${CMAKE_COMMAND} @@ -1033,12 +983,14 @@ add_custom_target(uncrustify-version -P ${PROJECT_SOURCE_DIR}/cmake/CheckUncrustifyVersion.cmake) add_glob_target( - TARGET lintuncrustify + TARGET lintc-uncrustify COMMAND ${UNCRUSTIFY_PRG} FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check - FILES ${LINT_NVIM_SOURCES} - ) -add_dependencies(lintuncrustify uncrustify-version) + FILES ${LINT_NVIM_SOURCES}) +add_dependencies(lintc-uncrustify uncrustify-version) + +add_custom_target(lintc) +add_dependencies(lintc lintc-clint lintc-uncrustify) add_custom_target(formatc COMMAND ${CMAKE_COMMAND} @@ -1048,14 +1000,6 @@ add_custom_target(formatc WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) add_dependencies(formatc uncrustify-version) -add_custom_target( - lintcfull - COMMAND - ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} --output=${LINT_OUTPUT_FORMAT} ${LINT_NVIM_REL_SOURCES} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} lintuncrustify -) - add_custom_target(generated-sources DEPENDS ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS} diff --git a/src/nvim/assert.h b/src/nvim/assert.h index ad92d9a2af..1941f4c33c 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -61,7 +61,7 @@ # define STATIC_ASSERT_STATEMENT(cond, msg) _Static_assert(cond, msg) // if we're dealing with gcc >= 4.6 in C99 mode, we can still use // _Static_assert but we need to suppress warnings, this is pretty ugly. -#elif (!defined(__clang__) && !defined(__INTEL_COMPILER)) && \ +#elif (!defined(__clang__) && !defined(__INTEL_COMPILER)) && /* NOLINT(whitespace/parens)*/ \ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) # define STATIC_ASSERT_STATEMENT(cond, msg) _Static_assert(cond, msg) diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 8ff7f7f43a..1ee3b5bf69 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -434,7 +434,7 @@ extern bool tv_in_free_unref_items; /// @param li Name of the variable with current listitem_T entry. /// @param code Cycle body. #define TV_LIST_ITER(l, li, code) \ - _TV_LIST_ITER_MOD( , l, li, code) + _TV_LIST_ITER_MOD( , l, li, code) // NOLINT(whitespace/parens) /// Iterate over a list /// diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index f025f21cf7..939e5d0810 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -206,7 +206,7 @@ typedef struct { struct { \ typval_T di_tv; /* Structure that holds scope dictionary itself. */ \ uint8_t di_flags; /* Flags. */ \ - char_u di_key[__VA_ARGS__]; /* Key value. */ \ + char_u di_key[__VA_ARGS__]; /* Key value. */ /* NOLINT(runtime/arrays)*/ \ } /// Structure to hold a scope dictionary diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index ff4f92e40b..6c931d3f88 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -266,7 +266,7 @@ static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE( const MPConvStack *const mpstack, const int copyID, const MPConvStackValType conv_type, const char *const objname) -REAL_FATTR_NONNULL_ARG(2, 3, 4, 7) REAL_FATTR_WARN_UNUSED_RESULT + REAL_FATTR_NONNULL_ARG(2, 3, 4, 7) REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE; /// Function for checking whether container references itself @@ -301,7 +301,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( MPConvStack *const mpstack, MPConvStackVal *const cur_mpsv, typval_T *const tv, const int copyID, const char *const objname) -REAL_FATTR_NONNULL_ARG(2, 4, 6) REAL_FATTR_WARN_UNUSED_RESULT; + REAL_FATTR_NONNULL_ARG(2, 4, 6) REAL_FATTR_WARN_UNUSED_RESULT; /// Convert single value /// @@ -358,7 +358,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( .pt = tv->vval.v_partial, }, }, - })); + })); break; } case VAR_LIST: { @@ -381,7 +381,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( .li = tv_list_first(tv->vval.v_list), }, }, - })); + })); TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START(tv, _mp_last(*mpstack)); break; } @@ -459,8 +459,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( const listitem_T *const highest_bits_li = ( TV_LIST_ITEM_NEXT(val_list, sign_li)); if (TV_LIST_ITEM_TV(highest_bits_li)->v_type != VAR_NUMBER - || ((highest_bits - = TV_LIST_ITEM_TV(highest_bits_li)->vval.v_number) + || ((highest_bits = TV_LIST_ITEM_TV(highest_bits_li)->vval.v_number) < 0)) { goto _convert_one_value_regular_dict; } @@ -536,7 +535,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( .li = tv_list_first(val_di->di_tv.vval.v_list), }, }, - })); + })); break; } case kMPMap: { @@ -571,7 +570,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( .li = tv_list_first(val_list), }, }, - })); + })); break; } case kMPExt: { @@ -581,8 +580,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( || tv_list_len((val_list = val_di->di_tv.vval.v_list)) != 2 || (TV_LIST_ITEM_TV(tv_list_first(val_list))->v_type != VAR_NUMBER) - || ((type - = TV_LIST_ITEM_TV(tv_list_first(val_list))->vval.v_number) + || ((type = TV_LIST_ITEM_TV(tv_list_first(val_list))->vval.v_number) > INT8_MAX) || type < INT8_MIN || (TV_LIST_ITEM_TV(tv_list_last(val_list))->v_type @@ -622,7 +620,7 @@ _convert_one_value_regular_dict: {} .todo = tv->vval.v_dict->dv_hashtab.ht_used, }, }, - })); + })); TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START(tv, tv->vval.v_dict, _mp_last(*mpstack)); break; @@ -640,7 +638,7 @@ typval_encode_stop_converting_one_item: TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE( TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, typval_T *const tv, const char *const objname) -REAL_FATTR_NONNULL_ARG(2, 3) REAL_FATTR_WARN_UNUSED_RESULT; + REAL_FATTR_NONNULL_ARG(2, 3) REAL_FATTR_WARN_UNUSED_RESULT; /// Convert the whole typval /// @@ -758,7 +756,7 @@ typval_encode_stop_converting_one_item: .todo = (size_t)pt->pt_argc, }, }, - })); + })); } break; case kMPConvPartialSelf: { @@ -797,7 +795,7 @@ typval_encode_stop_converting_one_item: .todo = dict->dv_hashtab.ht_used, }, }, - })); + })); TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START(NULL, pt->pt_dict, _mp_last(mpstack)); } else { diff --git a/src/nvim/globals.h b/src/nvim/globals.h index bb7c519b7c..aa8dbf6331 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -419,7 +419,7 @@ EXTERN win_T *prevwin INIT(= NULL); // previous window // -V:FOR_ALL_WINDOWS_IN_TAB:501 #define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \ for (win_T *wp = ((tp) == curtab) \ - ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next) + ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next) EXTERN win_T *curwin; // currently active window diff --git a/src/nvim/lib/ringbuf.h b/src/nvim/lib/ringbuf.h index 4fd110a531..907018a06e 100644 --- a/src/nvim/lib/ringbuf.h +++ b/src/nvim/lib/ringbuf.h @@ -25,14 +25,9 @@ #define _RINGBUF_LENGTH(rb) \ ((rb)->first == NULL ? 0 \ - : ((rb)->next == (rb)->first) ? (size_t)((rb)->buf_end - (rb)->buf) + 1 \ - : ((rb)->next > \ - (rb)->first) ? (size_t)((rb)->next - \ - (rb)->first) \ - : (size_t)((rb)-> \ - next - (rb)->buf + \ - (rb)->buf_end - \ - (rb)->first + 1)) + : ((rb)->next == (rb)->first) ? (size_t)((rb)->buf_end - (rb)->buf) + 1 \ + : ((rb)->next > (rb)->first) ? (size_t)((rb)->next - (rb)->first) \ + : (size_t)((rb)->next - (rb)->buf + (rb)->buf_end - (rb)->first + 1)) #define _RINGBUF_NEXT(rb, var) \ ((var) == (rb)->buf_end ? (rb)->buf : (var) + 1) diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 609fef37d0..5f0f03dd69 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -39,6 +39,8 @@ typedef struct { size_t idx; } MPToAPIObjectStackItem; +// uncrustify:off + /// Convert type used by msgpack parser to Nvim API type. /// /// @param[in] obj Msgpack value to convert. @@ -118,7 +120,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) .mobj = &cur.mobj->via.array.ptr[idx], .aobj = &cur.aobj->data.array.items[idx], .container = false, - })); + })); } } else { *cur.aobj = ARRAY_OBJ(((Array) { @@ -127,7 +129,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) .items = (size > 0 ? xcalloc(size, sizeof(*cur.aobj->data.array.items)) : NULL), - })); + })); cur.container = true; kv_last(stack) = cur; } @@ -171,7 +173,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) .mobj = &cur.mobj->via.map.ptr[idx].val, .aobj = &cur.aobj->data.dictionary.items[idx].value, .container = false, - })); + })); } } } else { @@ -181,7 +183,7 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) .items = (size > 0 ? xcalloc(size, sizeof(*cur.aobj->data.dictionary.items)) : NULL), - })); + })); cur.container = true; kv_last(stack) = cur; } @@ -371,7 +373,7 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res) kvi_push(stack, ((APIToMPObjectStackItem) { .aobj = &cur.aobj->data.array.items[idx], .container = false, - })); + })); } } else { msgpack_pack_array(res, size); @@ -389,12 +391,11 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res) const size_t idx = cur.idx; cur.idx++; kv_last(stack) = cur; - msgpack_rpc_from_string(cur.aobj->data.dictionary.items[idx].key, - res); + msgpack_rpc_from_string(cur.aobj->data.dictionary.items[idx].key, res); kvi_push(stack, ((APIToMPObjectStackItem) { .aobj = &cur.aobj->data.dictionary.items[idx].value, .container = false, - })); + })); } } else { msgpack_pack_map(res, size); @@ -411,6 +412,8 @@ void msgpack_rpc_from_object(const Object result, msgpack_packer *const res) kvi_destroy(stack); } +// uncrustify:on + void msgpack_rpc_from_array(Array result, msgpack_packer *res) FUNC_ATTR_NONNULL_ARG(2) { diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 56fdb6de84..3ffab71f22 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -263,8 +263,7 @@ enum { /// Represented by 'a' flag. #define SHM_ALL_ABBREVIATIONS ((char[]) { \ SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \ - 0, \ - }) + 0 }) // characters for p_go: #define GO_ASEL 'a' // autoselect @@ -359,8 +358,7 @@ enum { STL_SHOWCMD, STL_FOLDCOL, STL_SIGNCOL, STL_VIM_EXPR, STL_SEPARATE, \ STL_TRUNCMARK, STL_USER_HL, STL_HIGHLIGHT, STL_TABPAGENR, STL_TABCLOSENR, \ STL_CLICK_FUNC, STL_TABPAGENR, STL_TABCLOSENR, STL_CLICK_FUNC, \ - 0, \ - }) + 0, }) // flags used for parsed 'wildmode' #define WIM_FULL 0x01 diff --git a/src/nvim/path.h b/src/nvim/path.h index 37a0883c7f..c8d192dffe 100644 --- a/src/nvim/path.h +++ b/src/nvim/path.h @@ -39,4 +39,4 @@ typedef enum file_comparison { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "path.h.generated.h" #endif -#endif +#endif // NVIM_PATH_H diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index bd872235ad..ea57e8a34c 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1735,7 +1735,7 @@ static void nfa_emit_equi_class(int c) case 0x1ef5: case 0x1ef7: case 0x1ef9: - EMIT2('y') EMIT2(y_acute) EMIT2(y_diaeresis) + EMIT2('y') EMIT2(y_acute) EMIT2(y_diaeresis) // NOLINT(whitespace/cast) EMIT2(0x177) EMIT2(0x1b4) EMIT2(0x233) EMIT2(0x24f) EMIT2(0x1e8f) EMIT2(0x1e99) EMIT2(0x1ef3) EMIT2(0x1ef5) EMIT2(0x1ef7) EMIT2(0x1ef9) @@ -5236,7 +5236,7 @@ static regsubs_T *addstate_here(nfa_list_T *l, nfa_state_T *state, regsubs_T *su sizeof(nfa_thread_T) * (size_t)count); } } - --l->n; + l->n--; *ip = listidx - 1; return r; diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h index 265e4b2819..4d146a1706 100644 --- a/src/nvim/spell_defs.h +++ b/src/nvim/spell_defs.h @@ -218,8 +218,7 @@ typedef struct { // the "w" library function for characters above 255. #define SPELL_TOFOLD(c) ((c) >= 128 ? utf_fold(c) : (int)spelltab.st_fold[c]) -#define SPELL_TOUPPER(c) ((c) >= 128 ? mb_toupper(c) \ - : (int)spelltab.st_upper[c]) +#define SPELL_TOUPPER(c) ((c) >= 128 ? mb_toupper(c) : (int)spelltab.st_upper[c]) #define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c]) diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index cb38e511bb..d0d667ef2c 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -575,7 +575,7 @@ static inline int spell_check_magic_string(FILE *const fd) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE { char buf[VIMSPELLMAGICL]; - SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd,; ); + SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd,; ); // NOLINT(whitespace/parens) if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { return SP_FORMERROR; } @@ -1054,7 +1054,7 @@ static int read_region_section(FILE *fd, slang_T *lp, int len) if (len > MAXREGIONS * 2) { return SP_FORMERROR; } - SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd,; ); + SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd,; ); // NOLINT(whitespace/parens) lp->sl_regions[len] = NUL; return 0; } @@ -1121,7 +1121,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) if (n > 0) { char buf[MAXWLEN + 1]; buf[0] = '^'; // always match at one position only - SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd,; ); + SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd,; ); // NOLINT(whitespace/parens) buf[n + 1] = NUL; lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC | RE_STRING); } @@ -1144,7 +1144,7 @@ static int read_rep_section(FILE *fd, garray_T *gap, int16_t *first) ga_grow(gap, cnt); // : - for (; gap->ga_len < cnt; ++gap->ga_len) { + for (; gap->ga_len < cnt; gap->ga_len++) { int c; ftp = &((fromto_T *)gap->ga_data)[gap->ga_len]; ftp->ft_from = (char *)read_cnt_string(fd, 1, &c); @@ -2875,7 +2875,7 @@ static unsigned get_affitem(int flagtype, char_u **pp) if (flagtype == AFT_NUM) { if (!ascii_isdigit(**pp)) { - ++*pp; // always advance, avoid getting stuck + (*pp)++; // always advance, avoid getting stuck return 0; } res = getdigits_int((char **)pp, true, 0);