fix: fix ASAN errors on clang 17 (#25469)

This commit is contained in:
dundargoc 2023-10-03 00:19:30 +02:00 committed by GitHub
parent eb1f0e8fcc
commit fd791db0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 7 deletions

View File

@ -3078,7 +3078,7 @@ static int ExpandUserDefined(const char *const pat, expand_T *xp, regmatch_T *re
*matches = NULL; *matches = NULL;
*numMatches = 0; *numMatches = 0;
char *const retstr = call_user_expand_func((user_expand_func_T)call_func_retstr, xp); char *const retstr = call_user_expand_func(call_func_retstr, xp);
if (retstr == NULL) { if (retstr == NULL) {
return FAIL; return FAIL;
} }
@ -3150,7 +3150,7 @@ static int ExpandUserList(expand_T *xp, char ***matches, int *numMatches)
{ {
*matches = NULL; *matches = NULL;
*numMatches = 0; *numMatches = 0;
list_T *const retlist = call_user_expand_func((user_expand_func_T)call_func_retlist, xp); list_T *const retlist = call_user_expand_func(call_func_retlist, xp);
if (retlist == NULL) { if (retlist == NULL) {
return FAIL; return FAIL;
} }

View File

@ -1226,7 +1226,7 @@ fail:
/// ///
/// @return [allocated] NULL when calling function fails, allocated string /// @return [allocated] NULL when calling function fails, allocated string
/// otherwise. /// otherwise.
char *call_func_retstr(const char *const func, int argc, typval_T *argv) void *call_func_retstr(const char *const func, int argc, typval_T *argv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
{ {
typval_T rettv; typval_T rettv;

View File

@ -131,7 +131,7 @@ static const char e_non_numeric_argument_to_z[]
= N_("E144: Non-numeric argument to :z"); = N_("E144: Non-numeric argument to :z");
/// ":ascii" and "ga" implementation /// ":ascii" and "ga" implementation
void do_ascii(const exarg_T *const eap) void do_ascii(exarg_T *eap)
{ {
char *dig; char *dig;
int cc[MAX_MCO]; int cc[MAX_MCO];

View File

@ -1025,10 +1025,9 @@ int delete_first_msg(void)
} }
/// :messages command implementation /// :messages command implementation
void ex_messages(void *const eap_p) void ex_messages(exarg_T *eap)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
const exarg_T *const eap = (const exarg_T *)eap_p;
struct msg_hist *p; struct msg_hist *p;
if (strcmp(eap->arg, "clear") == 0) { if (strcmp(eap->arg, "clear") == 0) {

View File

@ -7,6 +7,7 @@
#include "klib/kvec.h" #include "klib/kvec.h"
#include "nvim/api/private/defs.h" #include "nvim/api/private/defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/grid_defs.h" #include "nvim/grid_defs.h"
#include "nvim/macros.h" #include "nvim/macros.h"
#include "nvim/types.h" #include "nvim/types.h"

View File

@ -282,9 +282,10 @@ static char writebuf[kRWBufferSize];
/// ///
/// @param[in,out] rv RBuffer instance used. /// @param[in,out] rv RBuffer instance used.
/// @param[in,out] fp File to work with. /// @param[in,out] fp File to work with.
static void file_rb_write_full_cb(RBuffer *const rv, FileDescriptor *const fp) static void file_rb_write_full_cb(RBuffer *const rv, void *const fp_in)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
FileDescriptor *const fp = fp_in;
assert(fp->wr); assert(fp->wr);
assert(rv->data == (void *)fp); assert(rv->data == (void *)fp);
if (rbuffer_size(rv) == 0) { if (rbuffer_size(rv) == 0) {