build: update clang v21, fix warnings

- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per
  `readability-uppercase-literal-suffix`
This commit is contained in:
dundargoc
2025-11-09 21:22:54 +01:00
committed by Justin M. Keyes
parent e243bed18f
commit 8a4bee3ed0
55 changed files with 122 additions and 116 deletions
+3
View File
@@ -38,7 +38,9 @@ Checks: >
-hicpp-signed-bitwise,
-misc-unused-parameters,
-modernize-macro-to-enum,
-readability-avoid-const-params-in-decls, Cosmetic: our generated declarations inherit const from definitions,
-readability-avoid-nested-conditional-operator,
-readability-avoid-unconditional-preprocessor-if, False positive in generated config.h,
-readability-else-after-return,
-readability-enum-initial-value,
-readability-function-size,
@@ -50,6 +52,7 @@ Checks: >
-android-*,
-bugprone-easily-swappable-parameters,
-bugprone-inc-dec-in-conditions,
-bugprone-reserved-identifier, We use underscore prefix to indicate private names (e.g. "_shada_mark"),
-bugprone-swapped-arguments,
-clang-analyzer-*, Already covered by the cmake target "clang-analyzer",
-cppcoreguidelines-avoid-non-const-global-variables,
+4 -1
View File
@@ -1,4 +1,5 @@
#!/bin/bash
set -e
while (($# > 0)); do
case $1 in
@@ -17,7 +18,7 @@ if [[ $OS == Linux ]]; then
if [[ $CC == clang ]]; then
DEFAULT_CLANG_VERSION=$(echo | clang -dM -E - | grep __clang_major | awk '{print $3}')
CLANG_VERSION=19
CLANG_VERSION=21
if ((DEFAULT_CLANG_VERSION >= CLANG_VERSION)); then
echo "Default clang version is $DEFAULT_CLANG_VERSION, which is equal or larger than wanted version $CLANG_VERSION. Aborting!"
exit 1
@@ -26,6 +27,8 @@ if [[ $OS == Linux ]]; then
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $CLANG_VERSION
# Alternatively could use `./llvm.sh … all` above, but that is heavy/slow.
sudo apt-get install -y clang-tidy-$CLANG_VERSION
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$CLANG_VERSION 100
sudo update-alternatives --set clang /usr/bin/clang-$CLANG_VERSION
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG_VERSION 100
+2 -2
View File
@@ -124,7 +124,7 @@ void alist_new(void)
alist_init(curwin->w_alist);
}
#if !defined(UNIX)
#ifndef UNIX
/// Expand the file names in the global argument list.
/// If "fnum_list" is not NULL, use "fnum_list[fnum_len]" as a list of buffer
@@ -230,7 +230,7 @@ void alist_add(alist_T *al, char *fname, int set_fnum)
wp->w_locked--;
}
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
/// Adjust slashes in file names. Called after 'shellslash' was set.
void alist_slash_adjust(void)
+1 -1
View File
@@ -572,7 +572,7 @@ void do_augroup(char *arg, bool del_group)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_all_autocmds(void)
{
FOR_ALL_AUEVENTS(event) {
+3 -3
View File
@@ -1730,7 +1730,7 @@ static void enter_buffer(buf_T *buf)
// Stop Visual mode before changing curbuf. Assumes curbuf and curwin->w_buffer is valid; if not,
// buf_freeall() should've done this already!
if (VIsual_active
#if defined(EXITFREE)
#ifdef EXITFREE
&& !entered_free_all_mem
#endif
) {
@@ -3177,7 +3177,7 @@ int buflist_add(char *fname, int flags)
return 0;
}
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
/// Adjust slashes in file names. Called after 'shellslash' was set.
void buflist_slash_adjust(void)
{
@@ -3498,7 +3498,7 @@ void resettitle(void)
ui_call_set_title(cstr_as_string(lasttitle));
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_titles(void)
{
xfree(lasttitle);
+3 -3
View File
@@ -577,7 +577,7 @@ static void emit_err(Error_T *e)
}
}
#if defined(UNIX)
#ifdef UNIX
static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwriting, int *perm,
bool *device, bool *newfile, Error_T *err)
@@ -1158,7 +1158,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
}
}
#if defined(UNIX)
#ifdef UNIX
bool made_writable = false; // 'w' bit has been set
// When using ":w!" and the file was read-only: make it writable
@@ -1665,7 +1665,7 @@ restore_backup:
lnum -= start; // compute number of written lines
no_wait_return--; // may wait for return now
#if !defined(UNIX)
#ifndef UNIX
fname = sfname; // use shortname now, for the messages
#endif
if (!filtering) {
+2 -2
View File
@@ -186,7 +186,7 @@ static void wildescape(expand_T *xp, const char *str, int numfiles, char **files
p = vim_strsave_escaped(files[i], pat);
xfree(files[i]);
files[i] = p;
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
p = vim_strsave_escaped(files[i], " ");
xfree(files[i]);
files[i] = p;
@@ -3624,7 +3624,7 @@ void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dir
size_t filelen = strlen(file);
#if defined(MSWIN)
#ifdef MSWIN
// Using the platform's path separator (\) makes vim incorrectly
// treat it as an escape character, use '/' instead.
# define TMP_PATHSEPSTR "/"
+1 -1
View File
@@ -2356,7 +2356,7 @@ void set_last_insert(int c)
last_insert_skip = 0;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_last_insert(void)
{
API_CLEAR_STRING(last_insert);
+1 -1
View File
@@ -206,7 +206,7 @@ void eval_init(void)
func_init();
}
#if defined(EXITFREE)
#ifdef EXITFREE
void eval_clear(void)
{
evalvars_clear();
+1 -1
View File
@@ -82,7 +82,7 @@ repeat:
// Expand "~/path" for all systems and "~user/path" for Unix
if ((*fnamep)[0] == '~'
#if !defined(UNIX)
#ifndef UNIX
&& ((*fnamep)[1] == '/'
# ifdef BACKSLASH_IN_FILENAME
|| (*fnamep)[1] == '\\'
+2 -2
View File
@@ -2711,7 +2711,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
"find_in_path",
"float",
"folding",
#if defined(UNIX)
#ifdef UNIX
"fork",
#endif
"gettext",
@@ -2757,7 +2757,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
"statusline",
"spell",
"syntax",
#if !defined(UNIX)
#ifndef UNIX
"system",
#endif
"tablineat",
+1 -1
View File
@@ -1460,7 +1460,7 @@ void set_current_funccal(funccall_T *fc)
current_funccal = fc;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_all_functions(void)
{
hashitem_T *hi;
+1 -1
View File
@@ -345,7 +345,7 @@ void evalvars_init(void)
set_reg_var(0); // default for v:register is not 0 but '"'
}
#if defined(EXITFREE)
#ifdef EXITFREE
void evalvars_clear(void)
{
for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) {
+1 -1
View File
@@ -157,7 +157,7 @@ static void close_cb(uv_handle_t *handle)
static void exit_cb(uv_process_t *handle, int64_t status, int term_signal)
{
Proc *proc = handle->data;
#if defined(MSWIN)
#ifdef MSWIN
// Use stored/expected signal.
term_signal = proc->exit_signal;
#endif
+2 -2
View File
@@ -131,7 +131,7 @@ void loop_on_put(MultiQueue *queue, void *data)
}
}
#if !defined(EXITFREE)
#ifndef EXITFREE
static void loop_walk_cb(uv_handle_t *handle, void *arg)
{
if (!uv_is_closing(handle)) {
@@ -173,7 +173,7 @@ bool loop_close(Loop *loop, bool wait)
log_uv_handles(&loop->uv);
break;
}
#if defined(EXITFREE)
#ifdef EXITFREE
(void)didstop;
#else
if (!didstop) {
+5 -5
View File
@@ -1088,7 +1088,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
static char *prevcmd = NULL; // the previous command
#if defined(EXITFREE)
#ifdef EXITFREE
void free_prev_shellcmd(void)
{
xfree(prevcmd);
@@ -1515,7 +1515,7 @@ void do_shell(char *cmd, int flags)
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, false, curbuf);
}
#if !defined(UNIX)
#ifndef UNIX
static char *find_pipe(const char *cmd)
{
bool inquote = false;
@@ -1545,7 +1545,7 @@ static char *find_pipe(const char *cmd)
char *make_filter_cmd(char *cmd, char *itmp, char *otmp, bool do_in)
{
bool is_fish_shell =
#if defined(UNIX)
#ifdef UNIX
strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
#else
false;
@@ -1589,7 +1589,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp, bool do_in)
xstrlcpy(buf, cmd, len);
}
} else {
#if defined(UNIX)
#ifdef UNIX
// Put delimiters around the command (for concatenated commands) when
// redirecting input and/or output.
if (itmp != NULL || otmp != NULL) {
@@ -4799,7 +4799,7 @@ void global_exe(char *cmd)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_old_sub(void)
{
sub_set_replacement((SubReplacementString) { NULL, 0, NULL });
+25 -25
View File
@@ -33,34 +33,34 @@
// 3. Add documentation in ../doc/xxx.txt. Add a tag for both the short and
// long name of the command.
#define EX_RANGE 0x001u // allow a linespecs
#define EX_BANG 0x002u // allow a ! after the command name
#define EX_EXTRA 0x004u // allow extra args after command name
#define EX_XFILE 0x008u // expand wildcards in extra part
#define EX_NOSPC 0x010u // no spaces allowed in the extra part
#define EX_DFLALL 0x020u // default file range is 1,$
#define EX_WHOLEFOLD 0x040u // extend range to include whole fold also
#define EX_RANGE 0x001U // allow a linespecs
#define EX_BANG 0x002U // allow a ! after the command name
#define EX_EXTRA 0x004U // allow extra args after command name
#define EX_XFILE 0x008U // expand wildcards in extra part
#define EX_NOSPC 0x010U // no spaces allowed in the extra part
#define EX_DFLALL 0x020U // default file range is 1,$
#define EX_WHOLEFOLD 0x040U // extend range to include whole fold also
// when less than two numbers given
#define EX_NEEDARG 0x080u // argument required
#define EX_TRLBAR 0x100u // check for trailing vertical bar
#define EX_REGSTR 0x200u // allow "x for register designation
#define EX_COUNT 0x400u // allow count in argument, after command
#define EX_NOTRLCOM 0x800u // no trailing comment allowed
#define EX_ZEROR 0x1000u // zero line number allowed
#define EX_CTRLV 0x2000u // do not remove CTRL-V from argument
#define EX_CMDARG 0x4000u // allow "+command" argument
#define EX_BUFNAME 0x8000u // accepts buffer name
#define EX_BUFUNL 0x10000u // accepts unlisted buffer too
#define EX_ARGOPT 0x20000u // allow "++opt=val" argument
#define EX_SBOXOK 0x40000u // allowed in the sandbox
#define EX_CMDWIN 0x80000u // allowed in cmdline window
#define EX_MODIFY 0x100000u // forbidden in non-'modifiable' buffer
#define EX_FLAGS 0x200000u // allow flags after count in argument
#define EX_LOCK_OK 0x1000000u // command can be executed when textlock is
#define EX_NEEDARG 0x080U // argument required
#define EX_TRLBAR 0x100U // check for trailing vertical bar
#define EX_REGSTR 0x200U // allow "x for register designation
#define EX_COUNT 0x400U // allow count in argument, after command
#define EX_NOTRLCOM 0x800U // no trailing comment allowed
#define EX_ZEROR 0x1000U // zero line number allowed
#define EX_CTRLV 0x2000U // do not remove CTRL-V from argument
#define EX_CMDARG 0x4000U // allow "+command" argument
#define EX_BUFNAME 0x8000U // accepts buffer name
#define EX_BUFUNL 0x10000U // accepts unlisted buffer too
#define EX_ARGOPT 0x20000U // allow "++opt=val" argument
#define EX_SBOXOK 0x40000U // allowed in the sandbox
#define EX_CMDWIN 0x80000U // allowed in cmdline window
#define EX_MODIFY 0x100000U // forbidden in non-'modifiable' buffer
#define EX_FLAGS 0x200000U // allow flags after count in argument
#define EX_LOCK_OK 0x1000000U // command can be executed when textlock is
// set; when missing disallows editing another
// buffer when curbuf->b_ro_locked is set
#define EX_KEEPSCRIPT 0x4000000u // keep sctx of where command was invoked
#define EX_PREVIEW 0x8000000u // allow incremental command preview
#define EX_KEEPSCRIPT 0x4000000U // keep sctx of where command was invoked
#define EX_PREVIEW 0x8000000U // allow incremental command preview
#define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed
#define EX_FILE1 (EX_FILES | EX_NOSPC) // 1 file, defaults to current file
#define EX_WORD1 (EX_EXTRA | EX_NOSPC) // one extra word allowed
+1 -1
View File
@@ -6353,7 +6353,7 @@ static void ex_read(exarg_T *eap)
static char *prev_dir = NULL;
#if defined(EXITFREE)
#ifdef EXITFREE
void free_cd_dir(void)
{
XFREE_CLEAR(prev_dir);
+1 -1
View File
@@ -1131,7 +1131,7 @@ static char *get_view_file(char c)
*s++ = '=';
} else if (vim_ispathsep(*p)) {
*s++ = '=';
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
*s++ = (*p == ':') ? '-' : '+';
#else
*s++ = '+';
+2 -2
View File
@@ -1375,7 +1375,7 @@ char *find_file_in_path(char *ptr, size_t len, int options, int first, char *rel
file_to_find, search_ctx);
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_findfile(void)
{
API_CLEAR_STRING(ff_expand_buffer);
@@ -1463,7 +1463,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
if (vim_isAbsName(*file_to_find)
// "..", "../path", "." and "./path": don't use the path_option
|| rel_to_curdir
#if defined(MSWIN)
#ifdef MSWIN
// handle "\tmp" as absolute path
|| vim_ispathsep((*file_to_find)[0])
// handle "c:name" as absolute path
+3 -3
View File
@@ -279,7 +279,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
if (sfname == NULL) {
sfname = fname;
}
#if defined(UNIX)
#ifdef UNIX
fname = sfname;
#endif
@@ -3274,7 +3274,7 @@ void write_lnum_adjust(linenr_T offset)
}
}
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
/// Convert all backslashes in fname to forward slashes in-place,
/// unless when it looks like a URL.
void forward_slash(char *fname)
@@ -3865,7 +3865,7 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs
return reg_pat;
}
#if defined(EINTR)
#ifdef EINTR
// Type of buffer size argument of read() and write() is platform-dependent.
# ifdef MSWIN
+1 -1
View File
@@ -230,7 +230,7 @@
# define FUNC_API_DEPRECATED_SINCE(X)
#endif
#if defined(DEFINE_FUNC_ATTRIBUTES)
#ifdef DEFINE_FUNC_ATTRIBUTES
# define FUNC_ATTR_MALLOC REAL_FATTR_MALLOC
# define FUNC_ATTR_ALLOC_SIZE(x) REAL_FATTR_ALLOC_SIZE(x)
# define FUNC_ATTR_ALLOC_SIZE_PROD(x, y) REAL_FATTR_ALLOC_SIZE_PROD(x, y)
+1 -1
View File
@@ -1455,7 +1455,7 @@ static void closescript(void)
curscript--;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void close_all_scripts(void)
{
while (curscript >= 0) {
+1 -1
View File
@@ -1529,7 +1529,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_highlight(void)
{
ga_clear(&highlight_ga);
+1 -1
View File
@@ -6400,7 +6400,7 @@ static unsigned quote_meta(char *dest, char *src, int len)
return m;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_insexpand_stuff(void)
{
API_CLEAR_STRING(compl_orig_text);
+1 -1
View File
@@ -8,7 +8,7 @@
// USDT probes. Example invocation:
// NVIM_PROBE(nvim_foo_bar, 1, string.data);
#if defined(HAVE_SYS_SDT_H)
#ifdef HAVE_SYS_SDT_H
# include <sys/sdt.h> // IWYU pragma: keep
# define NVIM_PROBE(name, n, ...) STAP_PROBE##n(neovim, name, __VA_ARGS__)
+2 -2
View File
@@ -125,14 +125,14 @@
// Type of uv_buf_t.len is platform-dependent.
// Related: https://github.com/libuv/libuv/pull/1236
#if defined(MSWIN)
#ifdef MSWIN
# define UV_BUF_LEN(x) (ULONG)(x)
#else
# define UV_BUF_LEN(x) (x)
#endif
// Type of read()/write() `count` param is platform-dependent.
#if defined(MSWIN)
#ifdef MSWIN
# define IO_COUNT(x) (unsigned)(x)
#else
# define IO_COUNT(x) (x)
+1 -1
View File
@@ -23,7 +23,7 @@
#define hash_int64_t(key) hash_uint64_t((uint64_t)key)
#define equal_int64_t equal_simple
#if defined(ARCH_64)
#ifdef ARCH_64
# define hash_ptr_t(key) hash_uint64_t((uint64_t)(key))
# define equal_ptr_t(a, b) equal_uint64_t((uint64_t)(a), (uint64_t)(b))
#elif defined(ARCH_32)
+1 -1
View File
@@ -9,7 +9,7 @@
#include "nvim/highlight_defs.h"
#include "nvim/types_defs.h"
#if defined(__NetBSD__)
#ifdef __NetBSD__
# undef uint64_t
# define uint64_t uint64_t
#endif
+1 -1
View File
@@ -1810,7 +1810,7 @@ void set_last_cursor(win_T *win)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_all_marks(void)
{
int i;
+1 -1
View File
@@ -79,7 +79,7 @@ int xctz(uint64_t x)
unsigned xpopcount(uint64_t x)
{
// Use compiler builtin if possible.
#if defined(__NetBSD__)
#ifdef __NetBSD__
return popcount64(x);
#elif defined(__clang__) || defined(__GNUC__)
return (unsigned)__builtin_popcountll(x);
+1 -1
View File
@@ -3211,7 +3211,7 @@ static void ml_lineadd(buf_T *buf, int count)
}
}
#if defined(HAVE_READLINK)
#ifdef HAVE_READLINK
/// Resolve a symlink in the last component of a file name.
/// Note that f_resolve() does it for every part of the path, we don't do that
+1 -1
View File
@@ -826,7 +826,7 @@ char *arena_strdup(Arena *arena, const char *str)
return arena_memdupz(arena, str, strlen(str));
}
#if defined(EXITFREE)
#ifdef EXITFREE
# include "nvim/autocmd.h"
# include "nvim/buffer.h"
+1 -1
View File
@@ -3133,7 +3133,7 @@ const char *did_set_operatorfunc(optset_T *args FUNC_ATTR_UNUSED)
return NULL;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_operatorfunc_option(void)
{
callback_free(&opfunc_cb);
+2 -2
View File
@@ -572,7 +572,7 @@ static const char *find_dup_item(const char *origval, const char *newval, const
return NULL;
}
#if defined(EXITFREE)
#ifdef EXITFREE
/// Free all options.
void free_all_options(void)
{
@@ -5764,7 +5764,7 @@ void set_context_in_set_cmd(expand_T *xp, char *arg, int opt_flags)
s--;
}
if ((*p == ' ' && ((xp->xp_backslash & XP_BS_THREE) && (p - s) < 3))
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
|| (*p == ',' && (flags & kOptFlagComma) && (p - s) < 1)
#else
|| (*p == ',' && (flags & kOptFlagComma) && (p - s) < 2)
+8 -8
View File
@@ -243,7 +243,7 @@ size_t os_get_fullenv_size(void)
FreeEnvironmentStringsW(envstrings);
#else
# if defined(HAVE__NSGETENVIRON)
# ifdef HAVE__NSGETENVIRON
char **environ = *_NSGetEnviron();
# else
extern char **environ;
@@ -301,7 +301,7 @@ void os_copy_fullenv(char **env, size_t env_size)
FreeEnvironmentStringsW(envstrings);
#else
# if defined(HAVE__NSGETENVIRON)
# ifdef HAVE__NSGETENVIRON
char **environ = *_NSGetEnviron();
# else
extern char **environ;
@@ -360,7 +360,7 @@ char *os_getenvname_at_index(size_t index)
FreeEnvironmentStringsW(envstrings);
return name;
#else
# if defined(HAVE__NSGETENVIRON)
# ifdef HAVE__NSGETENVIRON
char **environ = *_NSGetEnviron();
# else
extern char **environ;
@@ -573,7 +573,7 @@ static char *os_uv_homedir(void)
return NULL;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_homedir(void)
{
@@ -686,7 +686,7 @@ size_t expand_env_esc(const char *restrict srcp, char *restrict dst, int dstlen,
}
}
#if defined(UNIX)
#ifdef UNIX
// Verify that we have found the end of a Unix ${VAR} style variable
if (src[1] == '{' && *tail != '}') {
var = NULL;
@@ -698,7 +698,7 @@ size_t expand_env_esc(const char *restrict srcp, char *restrict dst, int dstlen,
*var = NUL;
var = vim_getenv(dst);
mustfree = true;
#if defined(UNIX)
#ifdef UNIX
}
#endif
} else if (src[1] == NUL // home directory
@@ -707,7 +707,7 @@ size_t expand_env_esc(const char *restrict srcp, char *restrict dst, int dstlen,
var = homedir;
tail = src + 1;
} else { // user directory
#if defined(UNIX)
#ifdef UNIX
// Copy ~user to dst[], so we can put a NUL after it.
tail = src;
var = dst;
@@ -775,7 +775,7 @@ size_t expand_env_esc(const char *restrict srcp, char *restrict dst, int dstlen,
// if var[] ends in a path separator and tail[] starts
// with it, skip a character
if (after_pathsep(dst, dst + c)
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
&& dst[c - 1] != ':'
#endif
&& vim_ispathsep(*tail)) {
+1 -1
View File
@@ -21,7 +21,7 @@
#include "nvim/os/fs.h"
#include "nvim/os/os_defs.h"
#if defined(HAVE_ACL)
#ifdef HAVE_ACL
# ifdef HAVE_SYS_ACL_H
# include <sys/acl.h>
# endif
+2 -2
View File
@@ -55,7 +55,7 @@ char *get_mess_lang(void)
{
char *p;
#if defined(LC_MESSAGES)
#ifdef LC_MESSAGES
p = get_locale_val(LC_MESSAGES);
#else
// This is necessary for Win32, where LC_MESSAGES is not defined and $LANG
@@ -288,7 +288,7 @@ static void init_locales(void)
#endif
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_locales(void)
{
if (locales == NULL) {
+1 -1
View File
@@ -15,7 +15,7 @@
# include <tlhelp32.h>
#endif
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
# include <string.h>
# include <sys/types.h>
# include <sys/user.h>
+1 -1
View File
@@ -296,7 +296,7 @@ void pty_proc_teardown(Loop *loop)
static void init_child(PtyProc *ptyproc)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NORETURN
{
#if defined(HAVE__NSGETENVIRON)
#ifdef HAVE__NSGETENVIRON
# define environ (*_NSGetEnviron())
#else
extern char **environ;
+1 -1
View File
@@ -137,7 +137,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
"[[ ${BASH_VERSINFO[0]} -ge 4 ]] && shopt -s globstar; ";
bool is_fish_shell =
#if defined(UNIX)
#ifdef UNIX
strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
#else
false;
+1 -1
View File
@@ -207,7 +207,7 @@ char *get_xdg_home(const XDGVarType idx)
if (dir) {
xmemcpyz(IObuff, appname, appname_len);
#if defined(MSWIN)
#ifdef MSWIN
if (idx == kXDGDataHome || idx == kXDGStateHome) {
xstrlcat(IObuff, "-data", IOSIZE);
}
+1 -1
View File
@@ -2,7 +2,7 @@
#include <stdbool.h>
#include <stddef.h> // IWYU pragma: keep
#include <time.h> // IWYU pragma: keep
#include <time.h> // NOLINT(misc-header-include-cycle) IWYU pragma: keep
#include "nvim/os/time_defs.h" // IWYU pragma: keep
+1 -1
View File
@@ -9,7 +9,7 @@
#include <sys/param.h>
#include <sys/socket.h>
#include <unistd.h>
#if defined(HAVE_TERMIOS_H)
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
// IWYU pragma: end_exports
+1 -1
View File
@@ -176,7 +176,7 @@ char *os_get_userdir(const char *name)
return NULL;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_users(void)
{
+8 -8
View File
@@ -58,22 +58,22 @@ FileComparison path_full_compare(char *const s1, char *const s2, const bool chec
const bool expandenv)
FUNC_ATTR_NONNULL_ALL
{
char expanded1[MAXPATHL];
char expand1[MAXPATHL];
char full1[MAXPATHL];
char full2[MAXPATHL];
FileID file_id_1, file_id_2;
if (expandenv) {
expand_env(s1, expanded1, MAXPATHL);
expand_env(s1, expand1, MAXPATHL);
} else {
xstrlcpy(expanded1, s1, MAXPATHL);
xstrlcpy(expand1, s1, MAXPATHL);
}
bool id_ok_1 = os_fileid(expanded1, &file_id_1);
bool id_ok_1 = os_fileid(expand1, &file_id_1);
bool id_ok_2 = os_fileid(s2, &file_id_2);
if (!id_ok_1 && !id_ok_2) {
// If os_fileid() doesn't work, may compare the names.
if (checkname) {
vim_FullName(expanded1, full1, MAXPATHL, false);
vim_FullName(expand1, full1, MAXPATHL, false);
vim_FullName(s2, full2, MAXPATHL, false);
if (path_fnamecmp(full1, full2) == 0) {
return kEqualFileNames;
@@ -562,7 +562,7 @@ bool path_has_wildcard(const char *p)
FUNC_ATTR_NONNULL_ALL
{
for (; *p; MB_PTR_ADV(p)) {
#if defined(UNIX)
#ifdef UNIX
if (p[0] == '\\' && p[1] != NUL) {
p++;
continue;
@@ -594,7 +594,7 @@ bool path_has_exp_wildcard(const char *p)
FUNC_ATTR_NONNULL_ALL
{
for (; *p != NUL; MB_PTR_ADV(p)) {
#if defined(UNIX)
#ifdef UNIX
if (p[0] == '\\' && p[1] != NUL) {
p++;
continue;
@@ -729,7 +729,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
// compile the regexp into a program
regmatch_T regmatch;
#if defined(UNIX)
#ifdef UNIX
// Ignore case if given 'wildignorecase', else respect 'fileignorecase'.
regmatch.rm_ic = (flags & EW_ICASE) || p_fic;
#else
+2 -2
View File
@@ -1886,7 +1886,7 @@ static void decr_quickfix_busy(void)
#endif
}
#if defined(EXITFREE)
#ifdef EXITFREE
void check_quickfix_busy(void)
{
if (quickfix_busy != 0) {
@@ -7668,7 +7668,7 @@ void ex_helpgrep(exarg_T *eap)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_quickfix(void)
{
qf_free_all(NULL);
+2 -2
View File
@@ -2085,7 +2085,7 @@ int vim_regsub_multi(regmmatch_T *rmp, linenr_T lnum, char *source, char *dest,
#define MAX_REGSUB_NESTING 4
static char *eval_result[MAX_REGSUB_NESTING] = { NULL, NULL, NULL, NULL };
#if defined(EXITFREE)
#ifdef EXITFREE
void free_resub_eval_result(void)
{
for (int i = 0; i < MAX_REGSUB_NESTING; i++) {
@@ -16117,7 +16117,7 @@ void vim_regfree(regprog_T *prog)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_regexp_stuff(void)
{
ga_clear(&regstack);
+1 -1
View File
@@ -944,7 +944,7 @@ void shift_delete_registers(bool y_append)
y_regs[1].y_array = NULL; // set register "1 to empty
}
#if defined(EXITFREE)
#ifdef EXITFREE
void clear_registers(void)
{
for (int i = 0; i < NUM_REGISTERS; i++) {
+4 -4
View File
@@ -1786,7 +1786,7 @@ static inline char *add_dir(char *dest, const char *const dir, const size_t dir_
size_t appname_len = strlen(appname);
assert(appname_len < (IOSIZE - sizeof("-data")));
xmemcpyz(IObuff, appname, appname_len);
#if defined(MSWIN)
#ifdef MSWIN
if (type == kXDGDataHome || type == kXDGStateHome) {
xstrlcat(IObuff, "-data", IOSIZE);
appname_len += 5;
@@ -1857,7 +1857,7 @@ char *runtimepath_default(bool clean_arg)
if (data_home != NULL) {
data_len = strlen(data_home);
size_t nvim_data_size = appname_len;
#if defined(MSWIN)
#ifdef MSWIN
nvim_data_size += sizeof("-data") - 1; // -1: NULL byte should be ignored
#endif
if (data_len != 0) {
@@ -2559,7 +2559,7 @@ void ex_scriptnames(exarg_T *eap)
}
}
#if defined(BACKSLASH_IN_FILENAME)
#ifdef BACKSLASH_IN_FILENAME
/// Fix slashes in the list of script names for 'shellslash'.
void scriptnames_slash_adjust(void)
{
@@ -2620,7 +2620,7 @@ char *get_scriptname(sctx_T script_ctx, bool *should_free)
}
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_scriptnames(void)
{
profile_reset();
+1 -1
View File
@@ -289,7 +289,7 @@ static inline void free_spat(SearchPattern *const spat)
xfree(spat->additional_data);
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_search_patterns(void)
{
for (size_t i = 0; i < ARRAY_SIZE(spats); i++) {
+2 -2
View File
@@ -242,7 +242,7 @@ const char *did_set_tagfunc(optset_T *args)
return retval == FAIL ? e_invarg : NULL;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_tagfunc_option(void)
{
callback_free(&tfu_cb);
@@ -2452,7 +2452,7 @@ static bool found_tagfile_cb(int num_fnames, char **fnames, bool all, void *cook
return num_fnames > 0;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void free_tag_stuff(void)
{
ga_clear_strings(&tag_fnames);
+1 -1
View File
@@ -2564,7 +2564,7 @@ static void flush_buf(TUIData *tui)
static const char *tui_get_stty_erase(TermInput *input)
{
static char stty_erase[2] = { 0 };
#if defined(HAVE_TERMIOS_H)
#ifdef HAVE_TERMIOS_H
struct termios t;
if (tcgetattr(input->in_fd, &t) != -1) {
stty_erase[0] = (char)t.c_cc[VERASE];
+1 -1
View File
@@ -158,7 +158,7 @@ static bool undo_undoes = false;
static int lastmark = 0;
#if defined(U_DEBUG)
#ifdef U_DEBUG
// Check the undo structures for being valid. Print a warning when something
// looks wrong.
static int seen_b_u_curhead;
+1 -1
View File
@@ -3369,7 +3369,7 @@ static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp)
return wp;
}
#if defined(EXITFREE)
#ifdef EXITFREE
void win_free_all(void)
{
// avoid an error for switching tabpage with the cmdline window open