refactor: uncrustify #16090

This commit is contained in:
dundargoc
2021-10-30 02:23:20 +02:00
committed by GitHub
parent 16d06fa3eb
commit 4472c56d54
51 changed files with 293 additions and 328 deletions

View File

@@ -26,7 +26,7 @@
typedef enum {
kErrorTypeNone = -1,
kErrorTypeException,
kErrorTypeValidation
kErrorTypeValidation,
} ErrorType;
typedef enum {

View File

@@ -1728,7 +1728,6 @@ static void write_msg(String message, bool to_err)
pos = 0; \
continue; \
} \
\
line_buf[pos++] = message.data[i];
++no_wait_return;
@@ -2182,8 +2181,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
int p_crb_save = ewp->w_p_crb;
ewp->w_p_crb = false;
int width = build_stl_str_hl(
ewp,
int width = build_stl_str_hl(ewp,
(char_u *)buf,
sizeof(buf),
(char_u *)str.data,

View File

@@ -113,14 +113,14 @@
// These can't be used after statements in c89.
#ifdef __COUNTER__
# define STATIC_ASSERT_EXPR(e, m) \
((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0)
((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)), }) 0)
#else
// This can't be used twice on the same line so ensure if using in headers
// that the headers are not included twice (by wrapping in #ifndef...#endif)
// Note it doesn't cause an issue when used on same line of separate modules
// compiled with gcc -combine -fwhole-program.
# define STATIC_ASSERT_EXPR(e, m) \
((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0)
((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)), }) 0)
#endif
/// @def STRICT_ADD

View File

@@ -3399,7 +3399,7 @@ void free_titles(void)
/// be used when printing numbers in the status line.
typedef enum {
kNumBaseDecimal = 10,
kNumBaseHexadecimal = 16
kNumBaseHexadecimal = 16,
} NumberBase;

View File

@@ -24,7 +24,7 @@ enum getf_retvalues {
GETFILE_NOT_WRITTEN = 2, // "not written" error
GETFILE_SAME_FILE = 0, // success, same file
GETFILE_OPEN_OTHER = -1, // success, opened another file
GETFILE_UNUSED = 8
GETFILE_UNUSED = 8,
};
// Values for buflist_new() flags

View File

@@ -388,7 +388,7 @@ struct stl_item {
Highlight,
TabPage,
ClickFunc,
Trunc
Trunc,
} type;
};

View File

@@ -17,7 +17,7 @@ typedef enum {
kChannelStreamSocket,
kChannelStreamStdio,
kChannelStreamStderr,
kChannelStreamInternal
kChannelStreamInternal,
} ChannelStreamType;
typedef enum {
@@ -25,7 +25,7 @@ typedef enum {
kChannelPartStdout,
kChannelPartStderr,
kChannelPartRpc,
kChannelPartAll
kChannelPartAll,
} ChannelPart;
typedef enum {

View File

@@ -24,13 +24,13 @@ typedef enum {
SHAPE_IDX_MORE = 14, ///< Hit-return or More
SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line
SHAPE_IDX_SM = 16, ///< showing matching paren
SHAPE_IDX_COUNT = 17
SHAPE_IDX_COUNT = 17,
} ModeShape;
typedef enum {
SHAPE_BLOCK = 0, ///< block cursor
SHAPE_HOR = 1, ///< horizontal bar cursor
SHAPE_VER = 2 ///< vertical bar cursor
SHAPE_VER = 2, ///< vertical bar cursor
} CursorShape;
#define MSHAPE_NUMBERED 1000 // offset for shapes identified by number

View File

@@ -1536,7 +1536,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
enum {
DIFF_ED,
DIFF_UNIFIED,
DIFF_NONE
DIFF_NONE,
} diffstyle = DIFF_NONE;
if (dout->dout_fname == NULL) {

View File

@@ -7621,7 +7621,7 @@ int hkmap(int c)
enum {
hALEF = 0, BET, GIMEL, DALET, HEI, VAV, ZAIN, HET, TET, IUD,
KAFsofit, hKAF, LAMED, MEMsofit, MEM, NUNsofit, NUN, SAMEH, AIN,
PEIsofit, PEI, ZADIsofit, ZADI, KOF, RESH, hSHIN, TAV
PEIsofit, PEI, ZADIsofit, ZADI, KOF, RESH, hSHIN, TAV,
};
static char_u map[26] =
{ (char_u)hALEF /*a*/, (char_u)BET /*b*/, (char_u)hKAF /*c*/,

View File

@@ -70,7 +70,7 @@ typedef struct lval_S {
typedef enum {
VAR_FLAVOUR_DEFAULT = 1, // doesn't start with uppercase
VAR_FLAVOUR_SESSION = 2, // starts with uppercase, some lower
VAR_FLAVOUR_SHADA = 4 // all uppercase
VAR_FLAVOUR_SHADA = 4, // all uppercase
} var_flavour_T;
/// Defines for Vim variables

View File

@@ -30,7 +30,7 @@ typedef uint64_t uvarnumber_T;
typedef double float_T;
/// Refcount for dict or list that should not be freed
enum { DO_NOT_FREE_CNT = (INT_MAX / 2) };
enum { DO_NOT_FREE_CNT = (INT_MAX / 2), };
/// Additional values for tv_list_alloc() len argument
enum ListLenSpecials {

View File

@@ -8,7 +8,7 @@
typedef enum {
kProcessTypeUv,
kProcessTypePty
kProcessTypePty,
} ProcessType;
typedef struct process Process;

View File

@@ -198,7 +198,7 @@ void ex_perldo(exarg_T *eap)
// Command line expansion for :profile.
static enum {
PEXP_SUBCMD, ///< expand :profile sub-commands
PEXP_FUNC ///< expand :profile func {funcname}
PEXP_FUNC, ///< expand :profile func {funcname}
} pexpand_what;
static char *pexpand_cmds[] = {

View File

@@ -78,7 +78,7 @@ typedef enum {
ADDR_QUICKFIX, // quickfix list entry number
ADDR_UNSIGNED, // positive count or zero, defaults to 1
ADDR_OTHER, // something else, use line number for '$', '%', etc.
ADDR_NONE // no range used
ADDR_NONE, // no range used
} cmd_addr_T;
typedef struct exarg exarg_T;

View File

@@ -5868,7 +5868,7 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd,
ct_MODS,
ct_REGISTER,
ct_LT,
ct_NONE
ct_NONE,
} type = ct_NONE;
if ((vim_strchr((char_u *)"qQfF", *p) != NULL) && p[1] == '-') {

View File

@@ -2655,7 +2655,7 @@ void free_arshape_buf(void)
#endif
enum { MAX_CB_ERRORS = 1 };
enum { MAX_CB_ERRORS = 1, };
/// Color expression cmdline using built-in expressions parser
///

View File

@@ -21,7 +21,7 @@ enum RemapValues {
typedef enum {
FLUSH_MINIMAL,
FLUSH_TYPEAHEAD, // flush current typebuf contents
FLUSH_INPUT // flush typebuf and inchar() input
FLUSH_INPUT, // flush typebuf and inchar() input
} flush_buffers_T;
/// All possible |:map-arguments| usable in a |:map| command.
@@ -63,7 +63,7 @@ typedef struct map_arguments MapArguments;
#define KEYLEN_PART_MAP -2 // keylen value for incomplete mapping
/// Maximum number of streams to read script from
enum { NSCRIPT = 15 };
enum { NSCRIPT = 15, };
/// Streams to read script from
extern FileDescriptor *scriptin[NSCRIPT];

View File

@@ -1025,7 +1025,7 @@ EXTERN bool headless_mode INIT(= false);
typedef enum {
kUnknown,
kWorking,
kBroken
kBroken,
} WorkingStatus;
/// The scope of a working-directory command like `:cd`.

View File

@@ -103,7 +103,7 @@ typedef enum {
HLF_NFLOAT, // Floating window
HLF_MSG, // Message area
HLF_BORDER, // Floating window border
HLF_COUNT // MUST be the last one
HLF_COUNT, // MUST be the last one
} hlf_T;
EXTERN const char *hlf_names[] INIT(= {

View File

@@ -72,7 +72,7 @@ static enum {
EXP_CSCOPE_SUBCMD, // expand ":cscope" sub-commands
EXP_SCSCOPE_SUBCMD, // expand ":scscope" sub-commands
EXP_CSCOPE_FIND, // expand ":cscope find" arguments
EXP_CSCOPE_KILL // expand ":cscope kill" arguments
EXP_CSCOPE_KILL, // expand ":cscope kill" arguments
} expand_what;
/*

View File

@@ -52,13 +52,13 @@ typedef struct csi {
FILE *to_fp; // to cscope: FILE.
} csinfo_T;
typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
typedef enum { Add, Find, Help, Kill, Reset, Show, } csid_e;
typedef enum {
Store,
Get,
Free,
Print
Print,
} mcmd_e;
#endif // NVIM_IF_CSCOPE_DEFS_H

View File

@@ -245,7 +245,7 @@ enum key_extra {
KE_MOUSEMOVE = 100, // mouse moved with no button down
// , KE_CANCEL = 101 // return from vgetc
KE_EVENT = 102, // event
KE_COMMAND = 104 // <Cmd> special key
KE_COMMAND = 104, // <Cmd> special key
};
/*

View File

@@ -54,12 +54,10 @@
key_t key[2*T-1]; \
kbnode_##name##_t *ptr[]; \
} ; \
\
typedef struct { \
kbnode_##name##_t *root; \
int n_keys, n_nodes; \
} kbtree_##name##_t; \
\
typedef struct { \
kbnode_##name##_t *x; \
int i; \

View File

@@ -130,7 +130,6 @@
.buf_end = buf + size - 1, \
}; \
} \
\
static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
REAL_FATTR_UNUSED; \
static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
@@ -143,14 +142,12 @@
} \
XFREE_CLEAR(rb->buf); \
} \
\
static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
REAL_FATTR_UNUSED; \
static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
{ \
XFREE_CLEAR(rb->buf); \
} \
\
static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
RBType item) \
REAL_FATTR_NONNULL_ARG(1); \
@@ -166,7 +163,6 @@
*rb->next = item; \
rb->next = _RINGBUF_NEXT(rb, rb->next); \
} \
\
static inline ptrdiff_t funcprefix##_rb_find_idx(const TypeName##RingBuffer *const rb, \
const RBType *const item_p) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
@@ -183,21 +179,18 @@
return item_p - rb->buf + rb->buf_end - rb->first + 1; \
} \
} \
\
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
{ \
return (size_t)(rb->buf_end - rb->buf) + 1; \
} \
\
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
{ \
return _RINGBUF_LENGTH(rb); \
} \
\
static inline RBType *funcprefix##_rb_idx_p(const TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
@@ -212,7 +205,6 @@
return rb->first + idx; \
} \
} \
\
static inline RBType funcprefix##_rb_idx(const TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
@@ -221,7 +213,6 @@
{ \
return *funcprefix##_rb_idx_p(rb, idx); \
} \
\
static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
const size_t idx, \
RBType item) \
@@ -263,7 +254,6 @@
} \
rb->next = _RINGBUF_NEXT(rb, rb->next); \
} \
\
static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
const size_t idx) \
REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \

View File

@@ -51,36 +51,28 @@
#define MAP_IMPL(T, U, ...) \
INITIALIZER_DECLARE(T, U, __VA_ARGS__); \
__KHASH_IMPL(T##_##U##_map, , T, U, 1, T##_hash, T##_eq) \
\
void map_##T##_##U##_destroy(Map(T, U) *map) \
{ \
kh_dealloc(T##_##U##_map, &map->table); \
} \
\
U map_##T##_##U##_get(Map(T, U) *map, T key) \
{ \
khiter_t k; \
\
if ((k = kh_get(T##_##U##_map, &map->table, key)) == kh_end(&map->table)) { \
return INITIALIZER(T, U); \
} \
\
return kh_val(&map->table, k); \
} \
\
bool map_##T##_##U##_has(Map(T, U) *map, T key) \
{ \
return kh_get(T##_##U##_map, &map->table, key) != kh_end(&map->table); \
} \
\
T map_##T##_##U##_key(Map(T, U) *map, T key) \
{ \
khiter_t k; \
\
if ((k = kh_get(T##_##U##_map, &map->table, key)) == kh_end(&map->table)) { \
abort(); /* Caller must check map_has(). */ \
} \
\
return kh_key(&map->table, k); \
} \
U map_##T##_##U##_put(Map(T, U) *map, T key, U value) \
@@ -88,15 +80,12 @@
int ret; \
U rv = INITIALIZER(T, U); \
khiter_t k = kh_put(T##_##U##_map, &map->table, key, &ret); \
\
if (!ret) { \
rv = kh_val(&map->table, k); \
} \
\
kh_val(&map->table, k) = value; \
return rv; \
} \
\
U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put) \
{ \
int ret; \
@@ -112,23 +101,18 @@
return NULL; \
} \
} \
\
return &kh_val(&map->table, k); \
} \
\
U map_##T##_##U##_del(Map(T, U) *map, T key) \
{ \
U rv = INITIALIZER(T, U); \
khiter_t k; \
\
if ((k = kh_get(T##_##U##_map, &map->table, key)) != kh_end(&map->table)) { \
rv = kh_val(&map->table, k); \
kh_del(T##_##U##_map, &map->table, k); \
} \
\
return rv; \
} \
\
void map_##T##_##U##_clear(Map(T, U) *map) \
{ \
kh_clear(T##_##U##_map, &map->table); \

View File

@@ -16,11 +16,9 @@
#define MAP_DECLS(T, U) \
KHASH_DECLARE(T##_##U##_map, T, U) \
\
typedef struct { \
khash_t(T##_##U##_map) table; \
} Map(T, U); \
\
Map(T, U) *map_##T##_##U##_new(void); \
void map_##T##_##U##_free(Map(T, U) *map); \
void map_##T##_##U##_destroy(Map(T, U) *map); \

View File

@@ -235,7 +235,7 @@ static linenr_T lowest_marked = 0;
// argument for ml_upd_block0()
typedef enum {
UB_FNAME = 0, // update timestamp and filename
UB_SAME_DIR // update the B0_SAME_DIR flag
UB_SAME_DIR, // update the B0_SAME_DIR flag
} upd_block0_T;
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@@ -2408,7 +2408,7 @@ typedef enum {
SB_CLEAR_NONE = 0,
SB_CLEAR_ALL,
SB_CLEAR_CMDLINE_BUSY,
SB_CLEAR_CMDLINE_DONE
SB_CLEAR_CMDLINE_DONE,
} sb_clear_T;
// When to clear text on next msg.

View File

@@ -19,7 +19,7 @@ typedef enum {
kMTCharWise = 0, ///< character-wise movement/register
kMTLineWise = 1, ///< line-wise movement/register
kMTBlockWise = 2, ///< block-wise movement/register
kMTUnknown = -1 ///< Unknown or invalid motion type
kMTUnknown = -1, ///< Unknown or invalid motion type
} MotionType;
/*

View File

@@ -77,7 +77,7 @@ typedef int (*Indenter)(void);
enum GRegFlags {
kGRegNoExpr = 1, ///< Do not allow expression register.
kGRegExprSrc = 2, ///< Return expression itself for "=" register.
kGRegList = 4 ///< Return list.
kGRegList = 4, ///< Return list.
};
/// Definition of one register

View File

@@ -105,7 +105,7 @@
// WV_ and BV_ values get typecasted to this for the "indir" field
typedef enum {
PV_NONE = 0,
PV_MAXVAL = 0xffff // to avoid warnings for value out of range
PV_MAXVAL = 0xffff, // to avoid warnings for value out of range
} idopt_T;
/*

View File

@@ -836,7 +836,7 @@ enum {
BV_WM,
BV_VSTS,
BV_VTS,
BV_COUNT // must be the last one
BV_COUNT, // must be the last one
};
/*
@@ -889,7 +889,7 @@ enum {
WV_FCS,
WV_LCS,
WV_WINBL,
WV_COUNT // must be the last one
WV_COUNT, // must be the last one
};
// Value for b_p_ul indicating the global value must be used.

View File

@@ -68,7 +68,7 @@ enum {
/// Read or write buffer size
///
/// Currently equal to (IOSIZE - 1), but they do not need to be connected.
kRWBufferSize = 1024
kRWBufferSize = 1024,
};
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@@ -30,7 +30,7 @@
typedef enum {
kInputNone,
kInputAvail,
kInputEof
kInputEof,
} InbufPollResult;
static Stream read_stream = { .closed = true }; // Input before UI starts.

View File

@@ -10,7 +10,7 @@
typedef enum {
kWinpty,
kConpty
kConpty,
} PtyType;
typedef struct pty_process {

View File

@@ -33,7 +33,7 @@ typedef enum file_comparison {
kDifferentFiles = 2, ///< Both exist and are different files.
kBothFilesMissing = 4, ///< Both don't exist.
kOneFileMissing = 6, ///< One of them doesn't exist.
kEqualFileNames = 7 ///< Both don't exist and file names are same.
kEqualFileNames = 7, ///< Both don't exist and file names are same.
} FileComparison;
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@@ -14,13 +14,13 @@ typedef int colnr_T;
#define PRIdCOLNR "d"
/// Maximal (invalid) line number
enum { MAXLNUM = 0x7fffffff };
enum { MAXLNUM = 0x7fffffff, };
/// Maximal column number
enum { MAXCOL = INT_MAX };
enum { MAXCOL = INT_MAX, };
// Minimum line number
enum { MINLNUM = 1 };
enum { MINLNUM = 1, };
// minimum column number
enum { MINCOL = 1 };
enum { MINCOL = 1, };
/*
* position in file or buffer

View File

@@ -82,7 +82,7 @@ typedef enum
{
QFLT_QUICKFIX, ///< Quickfix list - global list
QFLT_LOCATION, ///< Location list - per window list
QFLT_INTERNAL ///< Internal - Temporary list used by
QFLT_INTERNAL, ///< Internal - Temporary list used by
// getqflist()/getloclist()
} qfltype_T;

View File

@@ -230,7 +230,7 @@ typedef enum {
STATE_REP_INI, // Prepare for using REP items.
STATE_REP, // Use matching REP items from the .aff file.
STATE_REP_UNDO, // Undo a REP item replacement.
STATE_FINAL // End of this node.
STATE_FINAL, // End of this node.
} state_T;
// Struct to keep the state at each level in suggest_try_change().

View File

@@ -5770,7 +5770,7 @@ static enum {
EXP_SUBCMD, // expand ":syn" sub-commands
EXP_CASE, // expand ":syn case" arguments
EXP_SPELL, // expand ":syn spell" arguments
EXP_SYNC // expand ":syn sync" arguments
EXP_SYNC, // expand ":syn sync" arguments
} expand_what;
/*

View File

@@ -1404,7 +1404,7 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int
TS_LINEAR, // linear searching forward, till EOF
TS_BINARY, // binary searching
TS_SKIP_BACK, // skipping backwards
TS_STEP_FORWARD // stepping forwards
TS_STEP_FORWARD, // stepping forwards
} state; // Current search state
int cmplen;

View File

@@ -1484,7 +1484,6 @@ static void unibi_goto(UI *ui, int row, int col)
if (str) { \
unibi_var_t vars[26 + 26]; \
size_t orig_pos = data->bufpos; \
\
memset(&vars, 0, sizeof(vars)); \
data->cork = true; \
retry: \

View File

@@ -24,7 +24,7 @@
#include "nvim/os/os_defs.h" // bring lots of system header files
/// length of a buffer to store a number in ASCII (64 bits binary + NUL)
enum { NUMBUFLEN = 65 };
enum { NUMBUFLEN = 65, };
#define MAX_TYPENR 65535
@@ -199,7 +199,7 @@ enum {
#define DIALOG_MSG_SIZE 1000 // buffer size for dialog_msg()
enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
// Maximum length of key sequence to be mapped.

View File

@@ -1525,7 +1525,6 @@ static inline void east_set_error(const ParserState *const pstate, ExprASTError
assert(want_node == kENodeOperator); \
/* Operator: may only be curly braces name, but only under certain */ \
/* conditions. */ \
\
/* First condition is that there is no space before a part of complex */ \
/* identifier. */ \
if (prev_token.type == kExprLexSpacing) { \
@@ -1534,7 +1533,6 @@ static inline void east_set_error(const ParserState *const pstate, ExprASTError
switch ((*top_node_p)->type) { \
/* Second is that previous node is one of the identifiers: */ \
/* complex, plain, curly braces. */ \
\
/* TODO(ZyX-I): Extend syntax to allow ${expr}. This is needed to */ \
/* handle environment variables like those bash uses for */ \
/* `export -f`: their names consist not only of alphanumeric */ \

View File

@@ -803,7 +803,7 @@ sp_incdec = remove # ignore/add/remove/force/not_defined
# Add or remove space before a backslash-newline at the end of a line.
#
# Default: add
sp_before_nl_cont = ignore # ignore/add/remove/force/not_defined
sp_before_nl_cont = force # ignore/add/remove/force/not_defined
# (OC) Add or remove space after the scope '+' or '-', as in '-(void) foo;'
# or '+(int) bar;'.
@@ -3022,7 +3022,7 @@ mod_case_brace = remove # ignore/add/remove/force/not_defined
mod_remove_empty_return = false # true/false
# Add or remove the comma after the last value of an enumeration.
mod_enum_last_comma = ignore # ignore/add/remove/force/not_defined
mod_enum_last_comma = add # ignore/add/remove/force/not_defined
# (OC) Whether to organize the properties. If true, properties will be
# rearranged according to the mod_sort_oc_property_*_weight factors.
@@ -3307,5 +3307,5 @@ set QUESTION REAL_FATTR_CONST
set QUESTION REAL_FATTR_NONNULL_ALL
set QUESTION REAL_FATTR_PURE
set QUESTION REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 66
# option(s) with 'not default' value: 67
#