mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
refactor: format all C files under nvim/ #15977
* refactor: format all C files under nvim * refactor: disable formatting for Vim-owned files: * src/nvim/indent_c.c * src/nvim/regexp.c * src/nvim/regexp_nfa.c * src/nvim/testdir/samples/memfile_test.c
This commit is contained in:
@@ -43,15 +43,15 @@
|
||||
#define TOLOWER_LOC tolower
|
||||
|
||||
// toupper() and tolower() for ASCII only and ignore the current locale.
|
||||
# define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A'))
|
||||
# define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A'))
|
||||
#define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A'))
|
||||
#define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A'))
|
||||
|
||||
// Like isalpha() but reject non-ASCII characters. Can't be used with a
|
||||
// special key (negative value).
|
||||
# define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z')
|
||||
# define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z')
|
||||
# define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
|
||||
# define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || ascii_isdigit(c))
|
||||
#define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z')
|
||||
#define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z')
|
||||
#define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
|
||||
#define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || ascii_isdigit(c))
|
||||
|
||||
// Returns empty string if it is NULL.
|
||||
#define EMPTY_IF_NULL(x) ((x) ? (x) : (char_u *)"")
|
||||
@@ -62,7 +62,7 @@
|
||||
// Don't apply 'langmap' if the character comes from the Stuff buffer or from a
|
||||
// mapping and the langnoremap option was set.
|
||||
// The do-while is just to ignore a ';' after the macro.
|
||||
# define LANGMAP_ADJUST(c, condition) \
|
||||
#define LANGMAP_ADJUST(c, condition) \
|
||||
do { \
|
||||
if (*p_langmap \
|
||||
&& (condition) \
|
||||
@@ -71,9 +71,9 @@
|
||||
&& (c) >= 0) \
|
||||
{ \
|
||||
if ((c) < 256) \
|
||||
c = langmap_mapchar[c]; \
|
||||
c = langmap_mapchar[c]; \
|
||||
else \
|
||||
c = langmap_adjust_mb(c); \
|
||||
c = langmap_adjust_mb(c); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -90,9 +90,9 @@
|
||||
# define mch_open_rw(n, f) os_open((n), (f), 0)
|
||||
#endif
|
||||
|
||||
# define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
|
||||
#define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
|
||||
|
||||
# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
|
||||
#define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
|
||||
|
||||
// MB_PTR_ADV(): advance a pointer to the next character, taking care of
|
||||
// multi-byte characters if needed.
|
||||
@@ -102,22 +102,22 @@
|
||||
// PTR2CHAR(): get character from pointer.
|
||||
|
||||
// Advance multi-byte pointer, skip over composing chars.
|
||||
# define MB_PTR_ADV(p) (p += mb_ptr2len((char_u *)p))
|
||||
#define MB_PTR_ADV(p) (p += mb_ptr2len((char_u *)p))
|
||||
// Advance multi-byte pointer, do not skip over composing chars.
|
||||
# define MB_CPTR_ADV(p) (p += utf_ptr2len(p))
|
||||
#define MB_CPTR_ADV(p) (p += utf_ptr2len(p))
|
||||
// Backup multi-byte pointer. Only use with "p" > "s" !
|
||||
# define MB_PTR_BACK(s, p) \
|
||||
(p -= utf_head_off((char_u *)s, (char_u *)p - 1) + 1)
|
||||
#define MB_PTR_BACK(s, p) \
|
||||
(p -= utf_head_off((char_u *)s, (char_u *)p - 1) + 1)
|
||||
// get length of multi-byte char, not including composing chars
|
||||
# define MB_CPTR2LEN(p) utf_ptr2len(p)
|
||||
#define MB_CPTR2LEN(p) utf_ptr2len(p)
|
||||
|
||||
# define MB_COPY_CHAR(f, t) mb_copy_char((const char_u **)(&f), &t);
|
||||
#define MB_COPY_CHAR(f, t) mb_copy_char((const char_u **)(&f), &t);
|
||||
|
||||
# define MB_CHARLEN(p) mb_charlen(p)
|
||||
# define MB_CHAR2LEN(c) mb_char2len(c)
|
||||
# define PTR2CHAR(p) utf_ptr2char(p)
|
||||
#define MB_CHARLEN(p) mb_charlen(p)
|
||||
#define MB_CHAR2LEN(c) mb_char2len(c)
|
||||
#define PTR2CHAR(p) utf_ptr2char(p)
|
||||
|
||||
# define RESET_BINDING(wp) \
|
||||
#define RESET_BINDING(wp) \
|
||||
do { \
|
||||
(wp)->w_p_scb = false; \
|
||||
(wp)->w_p_crb = false; \
|
||||
@@ -132,8 +132,8 @@
|
||||
///
|
||||
/// -V:ARRAY_SIZE:1063
|
||||
#define ARRAY_SIZE(arr) \
|
||||
((sizeof(arr)/sizeof((arr)[0])) \
|
||||
/ ((size_t)(!(sizeof(arr) % sizeof((arr)[0])))))
|
||||
((sizeof(arr)/sizeof((arr)[0])) \
|
||||
/ ((size_t)(!(sizeof(arr) % sizeof((arr)[0])))))
|
||||
|
||||
/// Get last array entry
|
||||
///
|
||||
@@ -156,7 +156,7 @@
|
||||
#ifndef __has_attribute
|
||||
# define NVIM_HAS_ATTRIBUTE(x) 0
|
||||
#elif defined(__clang__) && __clang__ == 1 \
|
||||
&& (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5))
|
||||
&& (__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.
|
||||
@@ -166,7 +166,7 @@
|
||||
#endif
|
||||
|
||||
#if NVIM_HAS_ATTRIBUTE(fallthrough) \
|
||||
&& (!defined(__apple_build_version__) || __apple_build_version__ >= 7000000)
|
||||
&& (!defined(__apple_build_version__) || __apple_build_version__ >= 7000000)
|
||||
# define FALLTHROUGH {} __attribute__((fallthrough))
|
||||
#else
|
||||
# define FALLTHROUGH
|
||||
@@ -204,29 +204,29 @@
|
||||
///
|
||||
#if defined(__clang__) && __clang__ == 1
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic push")\
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"")
|
||||
# ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
_Pragma("clang diagnostic push")\
|
||||
_Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
# else
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
|
||||
_Pragma("clang diagnostic push")
|
||||
_Pragma("clang diagnostic push")
|
||||
# endif
|
||||
# define PRAGMA_DIAG_POP \
|
||||
_Pragma("clang diagnostic pop")
|
||||
_Pragma("clang diagnostic pop")
|
||||
#elif defined(__GNUC__)
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic push")\
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
|
||||
# ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
_Pragma("GCC diagnostic push")\
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
# else
|
||||
# define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic push")
|
||||
# endif
|
||||
# define PRAGMA_DIAG_POP \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
Reference in New Issue
Block a user