build: adjust clang-tidy warning exclusion logic

Enable all clang-tidy warnings by default instead of disabling them.
This ensures that we don't miss useful warnings on each clang-tidy
version upgrade. A drawback of this is that it will force us to either
fix or adjust the warnings as soon as possible.
This commit is contained in:
dundargoc 2023-11-10 14:06:04 +01:00 committed by dundargoc
parent a6e3d93421
commit 4880385809
19 changed files with 150 additions and 160 deletions

View File

@ -1,49 +1,71 @@
WarningsAsErrors: '*'
WarningsAsErrors: '*,-clang-diagnostic-unused-function'
Checks: >
-*,
Enable all warnings by default. This ensures we don't miss new and useful
warnings when a new version of clang-tidy is dropped.
bugprone-*,
google-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
IMPORTANT
clang-tidy doesn't support comments but we can simulate comments by just
writing text directly here. These are then interpreted as warnings and will
be dropped. As long as you start every sentence with a capital letter and
don't use commas in your "comments" you should be fine,
*,
Untriaged warnings. Please categorize them accordingly if you find a relevant
section for it,
-bugprone-assignment-in-if-condition,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-not-null-terminated-result,
-bugprone-reserved-identifier,
-bugprone-sizeof-expression,
-bugprone-suspicious-memory-comparison,
-bugprone-swapped-arguments,
-bugprone-switch-missing-default-case,
-bugprone-unsafe-functions,
-bugprone-unused-return-value,
-google-readability-braces-around-statements,
-google-readability-function-size,
-misc-header-include-cycle,
-misc-include-cleaner,
-misc-misplaced-const,
-misc-no-recursion,
-cert-env33-c,
-cert-err33-c,
-cert-err34-c,
-concurrency-mt-unsafe,
-cppcoreguidelines-narrowing-conversions,
Warnings that may be useful, but are too inconsistent to enable by default
May yield useful results with some manual triaging,
-bugprone-branch-clone,
-bugprone-macro-parentheses,
-bugprone-sizeof-expression,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
-misc-unused-parameters,
-modernize-macro-to-enum,
-performance-no-int-to-ptr,
-readability-avoid-const-params-in-decls,
-readability-avoid-unconditional-preprocessor-if,
-readability-braces-around-statements,
-readability-else-after-return,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-isolate-declaration,
Warnings that are rarely useful,
-altera-*, Checks related to OpenCL programming for FPGAs. Not relevant,
-android-*,
-bugprone-easily-swappable-parameters,
-bugprone-swapped-arguments,
-clang-analyzer-*, Already covered by the cmake target "clang-analyzer",
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
-llvm-header-guard, We use #pragma once,
-llvmlibc-restrict-system-libc-headers, We want to use glibc,
-misc-header-include-cycle, Looks useful but redundant with IWYU. We may replace IWYU with this one day,
-misc-include-cleaner, Looks useful but redundant with IWYU. We may replace IWYU with this one day,
-misc-misplaced-const,
-misc-no-recursion,
-performance-no-int-to-ptr,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-magic-numbers,
-readability-misleading-indentation,
-readability-non-const-parameter,
-readability-redundant-declaration,
-readability-redundant-function-ptr-dereference,
-readability-redundant-declaration, Conflicts with our header generation scripts,
-readability-suspicious-call-argument,
Aliases. These are just duplicates of other warnings and should always be ignored,
-bugprone-narrowing-conversions,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-exp42-c,
-cert-flp37-c,
-cert-msc24-c,
-cert-msc33-c,
-cppcoreguidelines-avoid-magic-numbers,
-google-readability-function-size,
-hicpp-function-size,
-llvm-else-after-return,

View File

@ -339,7 +339,7 @@ extern bool tv_in_free_unref_items;
/// @param[in] l List to iterate over.
/// @param li Name of the variable with current listitem_T entry.
/// @param code Cycle body.
#define _TV_LIST_ITER_MOD(modifier, l, li, code) \
#define TV_LIST_ITER_MOD(modifier, l, li, code) \
do { \
modifier list_T *const l_ = (l); \
if (l_ != NULL) { \
@ -359,7 +359,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) // NOLINT(whitespace/parens)
TV_LIST_ITER_MOD( , l, li, code) // NOLINT(whitespace/parens)
/// Iterate over a list
///
@ -370,7 +370,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_CONST(l, li, code) \
_TV_LIST_ITER_MOD(const, l, li, code)
TV_LIST_ITER_MOD(const, l, li, code)
// Below macros are macros to avoid duplicating code for functionally identical
// const and non-const function variants.

View File

@ -258,7 +258,7 @@
/// macros argument is (not) equal to `&TYPVAL_ENCODE_NODICT_VAR`.
const dict_T *const TYPVAL_ENCODE_NODICT_VAR = NULL;
static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
static inline int TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME,
void *const val, int *const val_copyID,
const MPConvStack *const mpstack, const int copyID,
@ -281,7 +281,7 @@ static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
/// @param[in] objname Object name, used for error reporting.
///
/// @return NOTDONE in case of success, what to return in case of failure.
static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
static inline int TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, void *const val, int *const val_copyID,
const MPConvStack *const mpstack, const int copyID, const MPConvStackValType conv_type,
const char *const objname)
@ -294,7 +294,7 @@ static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
return NOTDONE;
}
static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME,
MPConvStack *const mpstack, MPConvStackVal *const cur_mpsv,
typval_T *const tv, const int copyID,
@ -318,7 +318,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
/// @param[in] objname Object name, used for error reporting.
///
/// @return OK in case of success, FAIL in case of failure.
static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, MPConvStack *const mpstack,
MPConvStackVal *const cur_mpsv, typval_T *const tv, const int copyID, const char *const objname)
{
@ -346,7 +346,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
partial_T *const pt = tv->vval.v_partial;
(void)pt;
TYPVAL_ENCODE_CONV_FUNC_START(tv, (pt == NULL ? NULL : partial_name(pt)));
_mp_push(*mpstack, ((MPConvStackVal) {
kvi_push(*mpstack, ((MPConvStackVal) {
.type = kMPConvPartial,
.tv = tv,
.saved_copyID = copyID - 1,
@ -365,11 +365,11 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
break;
}
const int saved_copyID = tv_list_copyid(tv->vval.v_list);
_TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(tv->vval.v_list, lv_copyID, copyID,
kMPConvList);
TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(tv->vval.v_list, lv_copyID, copyID,
kMPConvList);
TYPVAL_ENCODE_CONV_LIST_START(tv, tv_list_len(tv->vval.v_list));
assert(saved_copyID != copyID);
_mp_push(*mpstack, ((MPConvStackVal) {
kvi_push(*mpstack, ((MPConvStackVal) {
.type = kMPConvList,
.tv = tv,
.saved_copyID = saved_copyID,
@ -380,7 +380,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
},
},
}));
TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START(tv, _mp_last(*mpstack));
TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START(tv, kv_last(*mpstack));
break;
}
case VAR_BOOL:
@ -518,12 +518,12 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
goto _convert_one_value_regular_dict;
}
const int saved_copyID = tv_list_copyid(val_di->di_tv.vval.v_list);
_TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_di->di_tv.vval.v_list,
lv_copyID, copyID,
kMPConvList);
TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_di->di_tv.vval.v_list,
lv_copyID, copyID,
kMPConvList);
TYPVAL_ENCODE_CONV_LIST_START(tv, tv_list_len(val_di->di_tv.vval.v_list));
assert(saved_copyID != copyID && saved_copyID != copyID - 1);
_mp_push(*mpstack, ((MPConvStackVal) {
kvi_push(*mpstack, ((MPConvStackVal) {
.tv = tv,
.type = kMPConvList,
.saved_copyID = saved_copyID,
@ -552,12 +552,12 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
});
const int saved_copyID = tv_list_copyid(val_di->di_tv.vval.v_list);
_TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_list, lv_copyID, copyID,
kMPConvPairs);
TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_list, lv_copyID, copyID,
kMPConvPairs);
TYPVAL_ENCODE_CONV_DICT_START(tv, TYPVAL_ENCODE_NODICT_VAR,
tv_list_len(val_list));
assert(saved_copyID != copyID && saved_copyID != copyID - 1);
_mp_push(*mpstack, ((MPConvStackVal) {
kvi_push(*mpstack, ((MPConvStackVal) {
.tv = tv,
.type = kMPConvPairs,
.saved_copyID = saved_copyID,
@ -600,12 +600,12 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
_convert_one_value_regular_dict: {}
const int saved_copyID = tv->vval.v_dict->dv_copyID;
_TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(tv->vval.v_dict, dv_copyID, copyID,
kMPConvDict);
TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(tv->vval.v_dict, dv_copyID, copyID,
kMPConvDict);
TYPVAL_ENCODE_CONV_DICT_START(tv, tv->vval.v_dict,
tv->vval.v_dict->dv_hashtab.ht_used);
assert(saved_copyID != copyID);
_mp_push(*mpstack, ((MPConvStackVal) {
kvi_push(*mpstack, ((MPConvStackVal) {
.tv = tv,
.type = kMPConvDict,
.saved_copyID = saved_copyID,
@ -619,11 +619,11 @@ _convert_one_value_regular_dict: {}
},
}));
TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START(tv, tv->vval.v_dict,
_mp_last(*mpstack));
kv_last(*mpstack));
break;
}
case VAR_UNKNOWN:
internal_error(STR(_TYPVAL_ENCODE_CONVERT_ONE_VALUE) "()");
internal_error(STR(TYPVAL_ENCODE_CONVERT_ONE_VALUE) "()");
return FAIL;
}
typval_encode_stop_converting_one_item:
@ -632,7 +632,7 @@ typval_encode_stop_converting_one_item:
goto typval_encode_stop_converting_one_item;
}
TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(
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;
@ -646,29 +646,29 @@ TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(
/// @param[in] objname Object name, used for error reporting.
///
/// @return OK in case of success, FAIL in case of failure.
TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(
TYPVAL_ENCODE_SCOPE int TYPVAL_ENCODE_ENCODE(
TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, typval_T *const top_tv,
const char *const objname)
{
const int copyID = get_copyID();
MPConvStack mpstack;
_mp_init(mpstack);
if (_TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack,
NULL,
top_tv, copyID, objname)
kvi_init(mpstack);
if (TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack,
NULL,
top_tv, copyID, objname)
== FAIL) {
goto encode_vim_to__error_ret;
}
/// Label common for this and convert_one_value functions, used for escaping
/// from macros like TYPVAL_ENCODE_CONV_DICT_START.
typval_encode_stop_converting_one_item:
while (_mp_size(mpstack)) {
MPConvStackVal *cur_mpsv = &_mp_last(mpstack);
while (kv_size(mpstack)) {
MPConvStackVal *cur_mpsv = &kv_last(mpstack);
typval_T *tv = NULL;
switch (cur_mpsv->type) {
case kMPConvDict: {
if (!cur_mpsv->data.d.todo) {
(void)_mp_pop(mpstack);
(void)kv_pop(mpstack);
cur_mpsv->data.d.dict->dv_copyID = cur_mpsv->saved_copyID;
TYPVAL_ENCODE_CONV_DICT_END(cur_mpsv->tv, *cur_mpsv->data.d.dictp);
continue;
@ -692,7 +692,7 @@ typval_encode_stop_converting_one_item:
}
case kMPConvList:
if (cur_mpsv->data.l.li == NULL) {
(void)_mp_pop(mpstack);
(void)kv_pop(mpstack);
tv_list_set_copyid(cur_mpsv->data.l.list, cur_mpsv->saved_copyID);
TYPVAL_ENCODE_CONV_LIST_END(cur_mpsv->tv);
continue;
@ -706,7 +706,7 @@ typval_encode_stop_converting_one_item:
break;
case kMPConvPairs: {
if (cur_mpsv->data.l.li == NULL) {
(void)_mp_pop(mpstack);
(void)kv_pop(mpstack);
tv_list_set_copyid(cur_mpsv->data.l.list, cur_mpsv->saved_copyID);
TYPVAL_ENCODE_CONV_DICT_END(cur_mpsv->tv, TYPVAL_ENCODE_NODICT_VAR);
continue;
@ -719,8 +719,8 @@ typval_encode_stop_converting_one_item:
TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(encode_vim_to__error_ret,
*TV_LIST_ITEM_TV(tv_list_first(kv_pair)));
if (
_TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack, cur_mpsv,
TV_LIST_ITEM_TV(tv_list_first(kv_pair)), copyID, objname)
TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack, cur_mpsv,
TV_LIST_ITEM_TV(tv_list_first(kv_pair)), copyID, objname)
== FAIL) {
goto encode_vim_to__error_ret;
}
@ -742,7 +742,7 @@ typval_encode_stop_converting_one_item:
cur_mpsv->data.p.stage = kMPConvPartialSelf;
if (pt != NULL && pt->pt_argc > 0) {
TYPVAL_ENCODE_CONV_LIST_START(NULL, pt->pt_argc);
_mp_push(mpstack, ((MPConvStackVal) {
kvi_push(mpstack, ((MPConvStackVal) {
.type = kMPConvPartialList,
.tv = NULL,
.saved_copyID = copyID - 1,
@ -766,10 +766,10 @@ typval_encode_stop_converting_one_item:
continue;
}
const int saved_copyID = dict->dv_copyID;
const int te_csr_ret = _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(TYPVAL_ENCODE_FIRST_ARG_NAME,
dict, &dict->dv_copyID,
&mpstack, copyID, kMPConvDict,
objname);
const int te_csr_ret = TYPVAL_ENCODE_CHECK_SELF_REFERENCE(TYPVAL_ENCODE_FIRST_ARG_NAME,
dict, &dict->dv_copyID,
&mpstack, copyID, kMPConvDict,
objname);
if (te_csr_ret != NOTDONE) {
if (te_csr_ret == FAIL) {
goto encode_vim_to__error_ret;
@ -780,7 +780,7 @@ typval_encode_stop_converting_one_item:
TYPVAL_ENCODE_CONV_DICT_START(NULL, pt->pt_dict,
dict->dv_hashtab.ht_used);
assert(saved_copyID != copyID && saved_copyID != copyID - 1);
_mp_push(mpstack, ((MPConvStackVal) {
kvi_push(mpstack, ((MPConvStackVal) {
.type = kMPConvDict,
.tv = NULL,
.saved_copyID = saved_copyID,
@ -794,7 +794,7 @@ typval_encode_stop_converting_one_item:
},
}));
TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START(NULL, pt->pt_dict,
_mp_last(mpstack));
kv_last(mpstack));
} else {
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, -1);
}
@ -802,14 +802,14 @@ typval_encode_stop_converting_one_item:
}
case kMPConvPartialEnd:
TYPVAL_ENCODE_CONV_FUNC_END(tv);
(void)_mp_pop(mpstack);
(void)kv_pop(mpstack);
break;
}
continue;
}
case kMPConvPartialList:
if (!cur_mpsv->data.a.todo) {
(void)_mp_pop(mpstack);
(void)kv_pop(mpstack);
TYPVAL_ENCODE_CONV_LIST_END(NULL);
continue;
} else if (cur_mpsv->data.a.argv != cur_mpsv->data.a.arg) {
@ -820,16 +820,16 @@ typval_encode_stop_converting_one_item:
break;
}
assert(tv != NULL);
if (_TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack,
cur_mpsv, tv, copyID, objname)
if (TYPVAL_ENCODE_CONVERT_ONE_VALUE(TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack,
cur_mpsv, tv, copyID, objname)
== FAIL) {
goto encode_vim_to__error_ret;
}
}
_mp_destroy(mpstack);
kvi_destroy(mpstack);
return OK;
encode_vim_to__error_ret:
_mp_destroy(mpstack);
kvi_destroy(mpstack);
return FAIL;
// Prevent “unused label” warnings.
goto typval_encode_stop_converting_one_item;

View File

@ -62,14 +62,6 @@ typedef struct {
/// Stack used to convert Vimscript values to messagepack.
typedef kvec_withinit_t(MPConvStackVal, 8) MPConvStack;
// Defines for MPConvStack
#define _mp_size kv_size
#define _mp_init kvi_init
#define _mp_destroy kvi_destroy
#define _mp_push kvi_push
#define _mp_pop kv_pop
#define _mp_last kv_last
static inline size_t tv_strlen(const typval_T *tv)
REAL_FATTR_ALWAYS_INLINE REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT
REAL_FATTR_NONNULL_ALL;
@ -95,21 +87,21 @@ static inline size_t tv_strlen(const typval_T *const tv)
/// copyID (variable) it is set to copyID.
/// @param[in] copyID CopyID used by the caller.
/// @param conv_type Type of the conversion, @see MPConvStackValType.
#define _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val, copyID_attr, copyID, \
conv_type) \
#define TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val, copyID_attr, copyID, \
conv_type) \
do { \
const int te_csr_ret = _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(TYPVAL_ENCODE_FIRST_ARG_NAME, \
(val), &(val)->copyID_attr, mpstack, \
copyID, conv_type, objname); \
const int te_csr_ret = TYPVAL_ENCODE_CHECK_SELF_REFERENCE(TYPVAL_ENCODE_FIRST_ARG_NAME, \
(val), &(val)->copyID_attr, mpstack, \
copyID, conv_type, objname); \
if (te_csr_ret != NOTDONE) { \
return te_csr_ret; \
} \
} while (0)
#define _TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf) \
#define TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf) \
pref##name##suf
#define _TYPVAL_ENCODE_FUNC_NAME_INNER(pref, name, suf) \
_TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)
#define TYPVAL_ENCODE_FUNC_NAME_INNER(pref, name, suf) \
TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)
/// Construct function name, possibly using macros
///
@ -121,21 +113,21 @@ static inline size_t tv_strlen(const typval_T *const tv)
/// @param[in] suf Suffix.
///
/// @return Concat: pref + #TYPVAL_ENCODE_NAME + suf.
#define _TYPVAL_ENCODE_FUNC_NAME(pref, suf) \
_TYPVAL_ENCODE_FUNC_NAME_INNER(pref, TYPVAL_ENCODE_NAME, suf)
#define TYPVAL_ENCODE_FUNC_NAME(pref, suf) \
TYPVAL_ENCODE_FUNC_NAME_INNER(pref, TYPVAL_ENCODE_NAME, suf)
/// Self reference checker function name
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE \
_TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _check_self_reference)
#define TYPVAL_ENCODE_CHECK_SELF_REFERENCE \
TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _check_self_reference)
/// Entry point function name
#define _TYPVAL_ENCODE_ENCODE \
_TYPVAL_ENCODE_FUNC_NAME(encode_vim_to_, )
#define TYPVAL_ENCODE_ENCODE \
TYPVAL_ENCODE_FUNC_NAME(encode_vim_to_, )
/// Name of the …convert_one_value function
#define _TYPVAL_ENCODE_CONVERT_ONE_VALUE \
_TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _convert_one_value)
#define TYPVAL_ENCODE_CONVERT_ONE_VALUE \
TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _convert_one_value)
/// Name of the dummy const dict_T *const variable
#define TYPVAL_ENCODE_NODICT_VAR \
_TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _nodict_var)
TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _nodict_var)

View File

@ -2,7 +2,7 @@
#ifdef HAVE_WORKING_LIBINTL
# include <libintl.h>
# define _(x) gettext(x)
# define _(x) gettext(x) // NOLINT(bugprone-reserved-identifier)
// XXX do we actually need this?
# ifdef gettext_noop
# define N_(x) gettext_noop(x)
@ -16,7 +16,7 @@
# undef setlocale
# endif
#else
# define _(x) ((char *)(x))
# define _(x) ((char *)(x)) // NOLINT(bugprone-reserved-identifier)
# define N_(x) x
# define NGETTEXT(x, xs, n) ((n) == 1 ? (x) : (xs))
# define bindtextdomain(x, y) // empty

View File

@ -24,12 +24,6 @@
#define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8
// takes 6 bytes for one cell)
#ifdef MSWIN
# define _PATHSEPSTR "\\"
#else
# define _PATHSEPSTR "/"
#endif
// FILETYPE_FILE used for file type detection
// FTPLUGIN_FILE used for loading filetype plugin files
// INDENT_FILE used for loading indent files
@ -64,15 +58,15 @@
#define DFLT_ERRORFILE "errors.err"
#ifndef SYS_VIMRC_FILE
# define SYS_VIMRC_FILE "$VIM" _PATHSEPSTR "sysinit.vim"
# define SYS_VIMRC_FILE "$VIM/sysinit.vim"
#endif
#ifndef DFLT_HELPFILE
# define DFLT_HELPFILE "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt"
# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
#endif
#ifndef SYNTAX_FNAME
# define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim"
# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
#endif
#ifndef EXRC_FILE

View File

@ -343,7 +343,7 @@ int main(int argc, char **argv)
// Don't redraw until much later.
RedrawingDisabled++;
setbuf(stdout, NULL);
setbuf(stdout, NULL); // NOLINT(bugprone-unsafe-functions)
full_screen = !silent_mode;

View File

@ -773,13 +773,14 @@ static void intersect_mov(Intersection *restrict x, Intersection *restrict y,
kv_size(*y) = yn;
}
bool intersect_mov_test(uint64_t *x, size_t nx, uint64_t *y, size_t ny, uint64_t *win, size_t nwin,
uint64_t *wout, size_t *nwout, uint64_t *dout, size_t *ndout)
bool intersect_mov_test(const uint64_t *x, size_t nx, const uint64_t *y, size_t ny,
const uint64_t *win, size_t nwin, uint64_t *wout, size_t *nwout,
uint64_t *dout, size_t *ndout)
{
// x is immutable in the context of intersect_mov. y might shrink, but we
// don't care about it (we get it the deleted ones in d)
Intersection xi = { .items = x, .size = nx };
Intersection yi = { .items = y, .size = ny };
Intersection xi = { .items = (uint64_t *)x, .size = nx };
Intersection yi = { .items = (uint64_t *)y, .size = ny };
Intersection w;
kvi_init(w);

View File

@ -1260,11 +1260,10 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
#ifdef HAVE_READLINK
// Expand symlink in the file name, because the swapfile is created
// with the actual file instead of with the symlink.
if (resolve_symlink(fname, fname_buf) == OK) {
fname_res = fname_buf;
} else
#endif
fname_res = (resolve_symlink(fname, fname_buf) == OK) ? fname_buf : fname;
#else
fname_res = fname;
#endif
}
if (do_list) {

View File

@ -2566,7 +2566,7 @@ static int opt_strings_flags(const char *val, char **values, unsigned *flagp, bo
if (strncmp(values[i], val, len) == 0
&& ((list && val[len] == ',') || val[len] == NUL)) {
val += len + (val[len] == ',');
assert(i < sizeof(1U) * 8);
assert(i < sizeof(new_flags) * 8);
new_flags |= (1U << i);
break; // check next item in val list
}

View File

@ -927,9 +927,7 @@ char *vim_getenv(const char *name)
// Find runtime path relative to the nvim binary: ../share/nvim/runtime
if (vim_path == NULL) {
vim_get_prefix_from_exepath(exe_name);
if (append_path(exe_name,
"share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR,
MAXPATHL) == OK) {
if (append_path(exe_name, "share/nvim/runtime/", MAXPATHL) == OK) {
vim_path = exe_name;
}
}

View File

@ -208,7 +208,7 @@ void ex_language(exarg_T *eap)
#ifdef HAVE_NL_MSG_CAT_CNTR
// Need to do this for GNU gettext, otherwise cached translations
// will be used again.
extern int _nl_msg_cat_cntr;
extern int _nl_msg_cat_cntr; // NOLINT(bugprone-reserved-identifier)
_nl_msg_cat_cntr++;
#endif

View File

@ -80,7 +80,7 @@ void os_icon_init(void)
const char *vimruntime = os_getenv("VIMRUNTIME");
if (vimruntime != NULL) {
snprintf(NameBuff, MAXPATHL, "%s" _PATHSEPSTR "neovim.ico", vimruntime);
snprintf(NameBuff, MAXPATHL, "%s/neovim.ico", vimruntime);
if (!os_path_exists(NameBuff)) {
WLOG("neovim.ico not found: %s", NameBuff);
} else {

View File

@ -3826,7 +3826,7 @@ static uint8_t *regnext(uint8_t *p)
}
// Set the next-pointer at the end of a node chain.
static void regtail(uint8_t *p, uint8_t *val)
static void regtail(uint8_t *p, const uint8_t *val)
{
int offset;
@ -5843,7 +5843,7 @@ static void restore_subexpr(regbehind_T *bp)
/// just after the last matched character.
/// - false when there is no match. Leaves rex.input and rex.lnum in an
/// undefined state!
static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
static bool regmatch(uint8_t *scan, const proftime_T *tm, int *timed_out)
{
uint8_t *next; // Next node.
int op;
@ -7505,7 +7505,7 @@ static int bt_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T l
}
// Compare a number with the operand of RE_LNUM, RE_COL or RE_VCOL.
static int re_num_cmp(uint32_t val, uint8_t *scan)
static int re_num_cmp(uint32_t val, const uint8_t *scan)
{
uint32_t n = (uint32_t)OPERAND_MIN(scan);
@ -8472,7 +8472,7 @@ static void realloc_post_list(void)
// to the closing brace.
// Keep in mind that 'ignorecase' applies at execution time, thus [a-z] may
// need to be interpreted as [a-zA-Z].
static int nfa_recognize_char_class(uint8_t *start, uint8_t *end, int extra_newl)
static int nfa_recognize_char_class(uint8_t *start, const uint8_t *end, int extra_newl)
{
#define CLASS_not 0x80
#define CLASS_af 0x40
@ -13356,7 +13356,7 @@ static void nfa_save_listids(nfa_regprog_T *prog, int *list)
}
// Restore list IDs from "list" to all NFA states.
static void nfa_restore_listids(nfa_regprog_T *prog, int *list)
static void nfa_restore_listids(nfa_regprog_T *prog, const int *list)
{
int i;
nfa_state_T *p;

View File

@ -1640,7 +1640,7 @@ char *get_lib_dir(void)
// Find library path relative to the nvim binary: ../lib/nvim/
char exe_name[MAXPATHL];
vim_get_prefix_from_exepath(exe_name);
if (append_path(exe_name, "lib" _PATHSEPSTR "nvim", MAXPATHL) == OK) {
if (append_path(exe_name, "lib/nvim", MAXPATHL) == OK) {
return xstrdup(exe_name);
}
return NULL;

View File

@ -54,8 +54,8 @@
#include "nvim/vim.h"
#ifdef HAVE_BE64TOH
# define _BSD_SOURCE 1
# define _DEFAULT_SOURCE 1
# define _BSD_SOURCE 1 // NOLINT(bugprone-reserved-identifier)
# define _DEFAULT_SOURCE 1 // NOLINT(bugprone-reserved-identifier)
# include ENDIAN_INCLUDE_FILE
#endif

View File

@ -852,9 +852,6 @@ static void find_word(matchinf_T *mip, int mode)
mip->mi_compoff = (int)(p - mip->mi_fword);
}
}
#if 0
c = mip->mi_compoff;
#endif
mip->mi_complen++;
if (flags & WF_COMPROOT) {
mip->mi_compextra++;
@ -880,16 +877,6 @@ static void find_word(matchinf_T *mip, int mode)
// Find following word in keep-case tree.
mip->mi_compoff = wlen;
find_word(mip, FIND_KEEPCOMPOUND);
#if 0 // Disabled, a prefix must not appear halfway through a compound
// word, unless the COMPOUNDPERMITFLAG is used, in which case it
// can't be a postponed prefix.
if (!slang->sl_nobreak || mip->mi_result == SP_BAD) {
// Check for following word with prefix.
mip->mi_compoff = c;
find_prefix(mip, FIND_COMPOUND);
}
#endif
}
if (!slang->sl_nobreak) {

View File

@ -1543,7 +1543,7 @@ static tags_read_status_T findtags_get_next_line(findtags_state_T *st, tagsearch
sinfo_p->curr_offset -= st->lbuf_size * 2;
if (sinfo_p->curr_offset < 0) {
sinfo_p->curr_offset = 0;
rewind(st->fp);
(void)fseek(st->fp, 0, SEEK_SET);
st->state = TS_STEP_FORWARD;
}
}

View File

@ -1774,9 +1774,6 @@ static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colo
{
unibi_term *ut = tui->ut;
const char *xterm_version = os_getenv("XTERM_VERSION");
#if 0 // We don't need to identify this specifically, for now.
bool roxterm = !!os_getenv("ROXTERM_ID");
#endif
bool xterm = terminfo_is_term_family(term, "xterm")
// Treat Terminal.app as generic xterm-like, for now.
|| nsterm;