diff options
author | Dundar Goc <gocdundar@gmail.com> | 2022-04-18 12:54:25 +0200 |
---|---|---|
committer | Dundar Goc <gocdundar@gmail.com> | 2022-04-29 13:52:12 +0200 |
commit | 995c1863685d7fa0cc2638b55efee55c4cb7ffc9 (patch) | |
tree | b5d650a10aba07e1dad76bac48dd46013ddfa2cf | |
parent | 8c548c9e5416b4e25b51c018ceaa433756ee99b1 (diff) | |
download | rneovim-995c1863685d7fa0cc2638b55efee55c4cb7ffc9.tar.gz rneovim-995c1863685d7fa0cc2638b55efee55c4cb7ffc9.tar.bz2 rneovim-995c1863685d7fa0cc2638b55efee55c4cb7ffc9.zip |
refactor(uncrustify): disable formatting in problematic code sections
-rw-r--r-- | src/nvim/api/extmark.c | 4 | ||||
-rw-r--r-- | src/nvim/assert.h | 6 | ||||
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 4 | ||||
-rw-r--r-- | src/nvim/fileio.c | 6 |
5 files changed, 20 insertions, 4 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index 8dca37a321..ff9c8f2d47 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -546,6 +546,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer goto error; } + // uncrustify:off + struct { const char *name; Object *opt; @@ -559,6 +561,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer { NULL, NULL, NULL }, }; + // uncrustify:on + for (int j = 0; hls[j].name && hls[j].dest; j++) { if (HAS_KEY(*hls[j].opt)) { *hls[j].dest = object_to_hl_id(*hls[j].opt, hls[j].name, err); diff --git a/src/nvim/assert.h b/src/nvim/assert.h index 65519a8004..bc5260b914 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -1,5 +1,3 @@ -// uncrustify:off - #ifndef NVIM_ASSERT_H #define NVIM_ASSERT_H @@ -110,6 +108,8 @@ # define STATIC_ASSERT_STATEMENT STATIC_ASSERT_EXPR #endif +// uncrustify:off + #define ASSERT_CONCAT_(a, b) a##b #define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b) // These can't be used after statements in c89. @@ -125,6 +125,8 @@ ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)), }) 0) #endif +// uncrustify:on + /// @def STRICT_ADD /// @brief Adds (a + b) and stores result in `c`. Aborts on overflow. /// diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f8e2f913bf..b7177792db 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3972,12 +3972,16 @@ static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string) if (op == '*') { f1 = f1 * f2; } else if (op == '/') { + // uncrustify:off + // Division by zero triggers error from AddressSanitizer f1 = (f2 == 0 ? ( #ifdef NAN f1 == 0 ? (float_T)NAN : #endif (f1 > 0 ? (float_T)INFINITY : (float_T)-INFINITY)) : f1 / f2); + + // uncrustify:on } else { emsg(_("E804: Cannot use '%' with Float")); return FAIL; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index f059175c88..662a65d5d7 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4317,6 +4317,8 @@ skip: lnum -= regmatch.startpos[0].lnum; } + // uncrustify:off + #define PUSH_PREVIEW_LINES() \ do { \ if (preview) { \ @@ -4336,6 +4338,8 @@ skip: } \ } while (0) + // uncrustify:on + // Push the match to preview_lines. PUSH_PREVIEW_LINES(); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c5bb9442bc..c4eb1200ec 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3,8 +3,6 @@ // fileio.c: read from and write to a file -// uncrustify:off - #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -4912,11 +4910,15 @@ int buf_check_timestamp(buf_T *buf) char *mesg = NULL; char *mesg2 = ""; bool helpmesg = false; + + // uncrustify:off enum { RELOAD_NONE, RELOAD_NORMAL, RELOAD_DETECT } reload = RELOAD_NONE; + // uncrustify:on + bool can_reload = false; uint64_t orig_size = buf->b_orig_size; int orig_mode = buf->b_orig_mode; |