mirror of
https://github.com/neovim/neovim.git
synced 2025-10-18 07:41:51 +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:
@@ -49,11 +49,11 @@
|
||||
#define STATIC_ASSERT_PRAGMA_START
|
||||
#define STATIC_ASSERT_PRAGMA_END
|
||||
#define STATIC_ASSERT(cond, msg) \
|
||||
do { \
|
||||
STATIC_ASSERT_PRAGMA_START \
|
||||
STATIC_ASSERT_STATEMENT(cond, msg); \
|
||||
STATIC_ASSERT_PRAGMA_END \
|
||||
} while (0)
|
||||
do { \
|
||||
STATIC_ASSERT_PRAGMA_START \
|
||||
STATIC_ASSERT_STATEMENT(cond, msg); \
|
||||
STATIC_ASSERT_PRAGMA_END \
|
||||
} while (0)
|
||||
|
||||
// the easiest case, when the mode is C11 (generic compiler) or Clang
|
||||
// advertises explicit support for c_static_assert, meaning it won't warn.
|
||||
@@ -68,19 +68,19 @@
|
||||
|
||||
# undef STATIC_ASSERT_PRAGMA_START
|
||||
|
||||
#if __GNUC__ >= 6
|
||||
# define STATIC_ASSERT_PRAGMA_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||
#else
|
||||
# define STATIC_ASSERT_PRAGMA_START \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-pedantic\"")
|
||||
#endif
|
||||
# if __GNUC__ >= 6
|
||||
# define STATIC_ASSERT_PRAGMA_START \
|
||||
_Pragma("GCC diagnostic push")\
|
||||
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||
# else
|
||||
# define STATIC_ASSERT_PRAGMA_START \
|
||||
_Pragma("GCC diagnostic push")\
|
||||
_Pragma("GCC diagnostic ignored \"-pedantic\"")
|
||||
# endif
|
||||
|
||||
# undef STATIC_ASSERT_PRAGMA_END
|
||||
# define STATIC_ASSERT_PRAGMA_END \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
_Pragma("GCC diagnostic pop")
|
||||
|
||||
// the same goes for clang in C99 mode, but we suppress a different warning
|
||||
#elif defined(__clang__) && __has_extension(c_static_assert)
|
||||
@@ -89,12 +89,12 @@
|
||||
|
||||
# undef STATIC_ASSERT_PRAGMA_START
|
||||
# define STATIC_ASSERT_PRAGMA_START \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wc11-extensions\"")
|
||||
_Pragma("clang diagnostic push")\
|
||||
_Pragma("clang diagnostic ignored \"-Wc11-extensions\"")
|
||||
|
||||
# undef STATIC_ASSERT_PRAGMA_END
|
||||
# define STATIC_ASSERT_PRAGMA_END \
|
||||
_Pragma("clang diagnostic pop")
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
// TODO(aktau): verify that this works, don't have MSVC on hand.
|
||||
#elif _MSC_VER >= 1600
|
||||
@@ -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
|
||||
|
Reference in New Issue
Block a user