mirror of
https://github.com/neovim/neovim.git
synced 2026-01-21 04:31:51 +10:00
@@ -221,6 +221,11 @@ else()
|
||||
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||
-Wstrict-prototypes -std=gnu99)
|
||||
|
||||
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
add_definitions(-Wimplicit-fallthrough)
|
||||
endif()
|
||||
|
||||
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
|
||||
# 3.4.1 used there.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
|
||||
@@ -3607,6 +3607,7 @@ int build_stl_str_hl(
|
||||
|
||||
case STL_OFFSET_X:
|
||||
base = kNumBaseHexadecimal;
|
||||
// fallthrough
|
||||
case STL_OFFSET:
|
||||
{
|
||||
long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL);
|
||||
@@ -3617,6 +3618,7 @@ int build_stl_str_hl(
|
||||
}
|
||||
case STL_BYTEVAL_X:
|
||||
base = kNumBaseHexadecimal;
|
||||
// fallthrough
|
||||
case STL_BYTEVAL:
|
||||
num = byteval;
|
||||
if (num == NL)
|
||||
|
||||
@@ -4916,14 +4916,17 @@ static unsigned quote_meta(char_u *dest, char_u *src, int len)
|
||||
if (ctrl_x_mode == CTRL_X_DICTIONARY
|
||||
|| ctrl_x_mode == CTRL_X_THESAURUS)
|
||||
break;
|
||||
// fallthrough
|
||||
case '~':
|
||||
if (!p_magic) /* quote these only if magic is set */
|
||||
break;
|
||||
// fallthrough
|
||||
case '\\':
|
||||
if (ctrl_x_mode == CTRL_X_DICTIONARY
|
||||
|| ctrl_x_mode == CTRL_X_THESAURUS)
|
||||
break;
|
||||
case '^': /* currently it's not needed. */
|
||||
// fallthrough
|
||||
case '^': // currently it's not needed.
|
||||
case '$':
|
||||
m++;
|
||||
if (dest != NULL)
|
||||
|
||||
@@ -9596,13 +9596,15 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
if (from) {
|
||||
break;
|
||||
}
|
||||
case kCdScopeTab: // FALLTHROUGH
|
||||
// fallthrough
|
||||
case kCdScopeTab:
|
||||
assert(tp);
|
||||
from = tp->tp_localdir;
|
||||
if (from) {
|
||||
break;
|
||||
}
|
||||
case kCdScopeGlobal: // FALLTHROUGH
|
||||
// fallthrough
|
||||
case kCdScopeGlobal:
|
||||
if (globaldir) { // `globaldir` is not always set.
|
||||
from = globaldir;
|
||||
} else if (os_dirname(cwd, MAXPATHL) == FAIL) { // Get the OS CWD.
|
||||
|
||||
@@ -1869,7 +1869,7 @@ void tv_free(typval_T *tv)
|
||||
}
|
||||
case VAR_FUNC: {
|
||||
func_unref(tv->vval.v_string);
|
||||
// FALLTHROUGH
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case VAR_STRING: {
|
||||
xfree(tv->vval.v_string);
|
||||
|
||||
@@ -4878,8 +4878,9 @@ void fix_help_buffer(void)
|
||||
continue;
|
||||
e1 = vim_strrchr(t1, '.');
|
||||
e2 = vim_strrchr(path_tail(f2), '.');
|
||||
if (e1 == NUL || e2 == NUL)
|
||||
if (e1 == NULL || e2 == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (fnamecmp(e1, ".txt") != 0
|
||||
&& fnamecmp(e1, fname + 4) != 0) {
|
||||
/* Not .txt and not .abx, remove it. */
|
||||
@@ -5949,9 +5950,8 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg)
|
||||
// :sign define {name} {args}... {last}=
|
||||
// | |
|
||||
// last p
|
||||
if (p == NUL)
|
||||
{
|
||||
/* Expand last argument name (before equal sign). */
|
||||
if (p == NULL) {
|
||||
// Expand last argument name (before equal sign).
|
||||
xp->xp_pattern = last;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
|
||||
@@ -1268,6 +1268,7 @@ static int command_line_handle_key(CommandLineState *s)
|
||||
}
|
||||
return command_line_changed(s);
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case K_UP:
|
||||
case K_DOWN:
|
||||
|
||||
@@ -89,6 +89,10 @@
|
||||
# undef FUNC_ATTR_NONNULL_RET
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_NORETURN
|
||||
# undef FUNC_ATTR_NORETURN
|
||||
#endif
|
||||
|
||||
#ifndef DID_REAL_ATTR
|
||||
# define DID_REAL_ATTR
|
||||
# ifdef __GNUC__
|
||||
@@ -107,6 +111,7 @@
|
||||
# define REAL_FATTR_UNUSED __attribute__((unused))
|
||||
# define REAL_FATTR_NONNULL_ALL __attribute__((nonnull))
|
||||
# define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
# define REAL_FATTR_NORETURN __attribute__((noreturn))
|
||||
|
||||
# ifdef __clang__
|
||||
// clang only
|
||||
@@ -176,6 +181,10 @@
|
||||
# ifndef REAL_FATTR_NONNULL_RET
|
||||
# define REAL_FATTR_NONNULL_RET
|
||||
# endif
|
||||
|
||||
# ifndef REAL_FATTR_NORETURN
|
||||
# define REAL_FATTR_NORETURN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef DEFINE_FUNC_ATTRIBUTES
|
||||
@@ -196,6 +205,7 @@
|
||||
# define FUNC_ATTR_NONNULL_ALL REAL_FATTR_NONNULL_ALL
|
||||
# define FUNC_ATTR_NONNULL_ARG(...) REAL_FATTR_NONNULL_ARG(__VA_ARGS__)
|
||||
# define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
|
||||
# define FUNC_ATTR_NORETURN REAL_FATTR_NORETURN
|
||||
#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
||||
# define FUNC_ATTR_MALLOC
|
||||
# define FUNC_ATTR_ALLOC_SIZE(x)
|
||||
@@ -209,4 +219,5 @@
|
||||
# define FUNC_ATTR_NONNULL_ALL
|
||||
# define FUNC_ATTR_NONNULL_ARG(...)
|
||||
# define FUNC_ATTR_NONNULL_RET
|
||||
# define FUNC_ATTR_NORETURN
|
||||
#endif
|
||||
|
||||
@@ -153,4 +153,22 @@
|
||||
#define STR_(x) #x
|
||||
#define STR(x) STR_(x)
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define NVIM_HAS_ATTRIBUTE(x) 0
|
||||
#elif defined(__clang__) && __clang__ == 1 \
|
||||
&& (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5))
|
||||
// Starting in Clang 3.6, __has_attribute was fixed to only report true for
|
||||
// GNU-style attributes. Prior to that, it reported true if _any_ backend
|
||||
// supported the attribute.
|
||||
# define NVIM_HAS_ATTRIBUTE(x) 0
|
||||
#else
|
||||
# define NVIM_HAS_ATTRIBUTE __has_attribute
|
||||
#endif
|
||||
|
||||
#if NVIM_HAS_ATTRIBUTE(fallthrough)
|
||||
# define FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
# define FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#endif // NVIM_MACROS_H
|
||||
|
||||
@@ -1861,6 +1861,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
} else {
|
||||
bangredo = true; // do_bang() will put cmd in redo buffer.
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case OP_INDENT:
|
||||
case OP_COLON:
|
||||
|
||||
@@ -133,7 +133,7 @@ void mch_free_acl(vim_acl_T aclent)
|
||||
}
|
||||
#endif
|
||||
|
||||
void mch_exit(int r)
|
||||
void mch_exit(int r) FUNC_ATTR_NORETURN
|
||||
{
|
||||
exiting = true;
|
||||
|
||||
|
||||
@@ -634,6 +634,7 @@ static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl)
|
||||
config |= CLASS_o7;
|
||||
break;
|
||||
}
|
||||
return FAIL;
|
||||
case 'a':
|
||||
if (*(p + 2) == 'z') {
|
||||
config |= CLASS_az;
|
||||
@@ -642,6 +643,7 @@ static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl)
|
||||
config |= CLASS_af;
|
||||
break;
|
||||
}
|
||||
return FAIL;
|
||||
case 'A':
|
||||
if (*(p + 2) == 'Z') {
|
||||
config |= CLASS_AZ;
|
||||
@@ -650,7 +652,7 @@ static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl)
|
||||
config |= CLASS_AF;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
return FAIL;
|
||||
default:
|
||||
return FAIL;
|
||||
}
|
||||
@@ -4194,6 +4196,7 @@ skip_add:
|
||||
subs = addstate(l, state->out, subs, pim, off_arg);
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
case NFA_MCLOSE1:
|
||||
case NFA_MCLOSE2:
|
||||
case NFA_MCLOSE3:
|
||||
|
||||
@@ -2047,7 +2047,7 @@ static inline ShaDaWriteResult shada_read_when_writing(
|
||||
}
|
||||
case kSDReadStatusNotShaDa: {
|
||||
ret = kSDWriteReadNotShada;
|
||||
// fallthrough
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case kSDReadStatusReadError: {
|
||||
return ret;
|
||||
|
||||
@@ -134,7 +134,7 @@ else
|
||||
endif
|
||||
|
||||
" Names of flaky tests.
|
||||
let s:flaky = ['Test_with_partial_callback']
|
||||
let s:flaky = ['Test_with_partial_callback()']
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
set nomore
|
||||
|
||||
@@ -275,4 +275,16 @@ describe('character classes in regexp', function()
|
||||
diff(sixlines(string.sub(punct1, 1)..digits..punct2..upper..punct3..
|
||||
lower..punct4..ctrl2..iso_text))
|
||||
end)
|
||||
it('does not convert character class ranges to an incorrect class', function()
|
||||
source([[
|
||||
1 s/\%#=0[0-z]//g
|
||||
2 s/\%#=1[0-z]//g
|
||||
3 s/\%#=2[0-z]//g
|
||||
4 s/\%#=0[^0-z]//g
|
||||
5 s/\%#=1[^0-z]//g
|
||||
6 s/\%#=2[^0-z]//g
|
||||
]])
|
||||
diff(string.rep(ctrl1..punct1..punct4..ctrl2..iso_text..'\n', 3)
|
||||
..string.rep(digits..punct2..upper..punct3..lower..'\n', 3))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user