diff options
-rw-r--r-- | .github/workflows/ci.yml | 31 | ||||
-rwxr-xr-x | .github/workflows/env.sh | 2 | ||||
-rw-r--r-- | src/nvim/assert.h | 4 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 2 | ||||
-rw-r--r-- | src/nvim/grid.c | 2 | ||||
-rw-r--r-- | src/nvim/math.c | 2 | ||||
-rw-r--r-- | src/nvim/strings.h | 2 | ||||
-rw-r--r-- | src/nvim/viml/parser/expressions.c | 4 |
8 files changed, 43 insertions, 6 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a98c6097c..4516d19fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,32 @@ jobs: ninja-build \ pkg-config + + - name: Cache uncrustify + id: cache-uncrustify + uses: actions/cache@v3 + with: + path: ${{ env.CACHE_UNCRUSTIFY }} + key: ${{ env.UNCRUSTIFY_VERSION }} + + - name: Clone uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: uncrustify/uncrustify + ref: ${{ env.UNCRUSTIFY_VERSION }} + path: uncrustify + + - name: Install uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + run: | + source_dir=uncrustify + build_dir=uncrustify/build + cmake -S $source_dir -B $build_dir -G Ninja -DCMAKE_BUILD_TYPE=Release + cmake --build $build_dir + mkdir -p $HOME/.cache + cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }} + - name: Cache artifacts uses: actions/cache@v2 with: @@ -92,6 +118,11 @@ jobs: args: --check runtime/ - if: "!cancelled()" + name: uncrustify + run: | + ${{ env.CACHE_UNCRUSTIFY }} -c ./src/uncrustify.cfg -q --check $(find ./src/nvim -name "*.[ch]") >/dev/null + + - if: "!cancelled()" name: lualint run: ./ci/run_lint.sh lualint diff --git a/.github/workflows/env.sh b/.github/workflows/env.sh index fe7543510e..c3959ac104 100755 --- a/.github/workflows/env.sh +++ b/.github/workflows/env.sh @@ -19,6 +19,8 @@ NVIM_LOG_FILE=$GITHUB_WORKSPACE/build/.nvimlog VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker +CACHE_UNCRUSTIFY=$HOME/.cache/uncrustify +UNCRUSTIFY_VERSION=uncrustify-0.75.0 CCACHE_BASEDIR=$GITHUB_WORKSPACE CCACHE_COMPRESS=1 CCACHE_SLOPPINESS=time_macros,file_macro diff --git a/src/nvim/assert.h b/src/nvim/assert.h index bc5260b914..ad92d9a2af 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -108,8 +108,6 @@ # 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,8 +123,6 @@ ((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/funcs.c b/src/nvim/eval/funcs.c index 62fe2033af..6fa5aac2d6 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -90,11 +90,13 @@ typedef enum { # pragma function(floor) # endif +// uncrustify:off PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH # include "funcs.generated.h" PRAGMA_DIAG_POP PRAGMA_DIAG_POP +// uncrustify:on #endif diff --git a/src/nvim/grid.c b/src/nvim/grid.c index fa5c193fe0..d241f86d1c 100644 --- a/src/nvim/grid.c +++ b/src/nvim/grid.c @@ -4,9 +4,9 @@ #include "nvim/arabic.h" #include "nvim/grid.h" #include "nvim/highlight.h" +#include "nvim/screen.h" #include "nvim/ui.h" #include "nvim/vim.h" -#include "nvim/screen.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "grid.c.generated.h" diff --git a/src/nvim/math.c b/src/nvim/math.c index 63a29509bd..04ded0fd39 100644 --- a/src/nvim/math.c +++ b/src/nvim/math.c @@ -1,7 +1,9 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +// uncrustify:off #include <math.h> +// uncrustify:on #include <stdint.h> #include <string.h> diff --git a/src/nvim/strings.h b/src/nvim/strings.h index 0503cecc8a..9ef1eb5816 100644 --- a/src/nvim/strings.h +++ b/src/nvim/strings.h @@ -6,8 +6,8 @@ #include <string.h> #include "nvim/eval/typval.h" -#include "nvim/types.h" #include "nvim/lib/kvec.h" +#include "nvim/types.h" /// Append string to string and return pointer to the next byte /// diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 41b4a7edd6..fd7dc17ee3 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -2646,6 +2646,7 @@ viml_pexpr_parse_figure_brace_closing_error: kvi_push(pt_stack, kEPTLambdaArguments); lambda_node = cur_node; } else { + // uncrustify:off ADD_IDENT(do { NEW_NODE_WITH_CUR_POS(cur_node, kExprNodeCurlyBracesIdentifier); @@ -2660,6 +2661,7 @@ viml_pexpr_parse_figure_brace_closing_error: want_node = kENodeValue; } while (0), Curly); + // uncrustify:on } if (pt_is_assignment(cur_pt) && !pt_is_assignment(kv_last(pt_stack))) { @@ -2737,6 +2739,7 @@ viml_pexpr_parse_figure_brace_closing_error: : HL(IdentifierName))); } else { if (scope == kExprVarScopeMissing) { + // uncrustify:off ADD_IDENT(do { NEW_NODE_WITH_CUR_POS(cur_node, kExprNodePlainIdentifier); cur_node->data.var.scope = scope; @@ -2745,6 +2748,7 @@ viml_pexpr_parse_figure_brace_closing_error: want_node = kENodeOperator; } while (0), IdentifierName); + // uncrustify:on } else { OP_MISSING; } |