diff --git a/.clang-tidy b/.clang-tidy index 17ba9cd..f01bfa5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,4 @@ Checks: "clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type" WarningsAsErrors: true HeaderFilterRegex: "" -AnalyzeTemporaryDtors: false FormatStyle: google diff --git a/bindings/debug.c b/bindings/debug.c index 52d7bc8..b7b625e 100644 --- a/bindings/debug.c +++ b/bindings/debug.c @@ -51,7 +51,7 @@ int main(int argc, char **argv) { // Build a syntax tree based on source code stored in a string. TSTree *tree = ts_parser_parse_string(parser, NULL, data, file_size); - TSNode root_node = ts_tree_root_node(tree); + // TSNode root_node = ts_tree_root_node(tree); // assert(ts_node_child_count(root_node) > 0); // Free all of the heap-allocated memory. diff --git a/justfile b/justfile index 63e732b..775fdb9 100644 --- a/justfile +++ b/justfile @@ -85,7 +85,7 @@ _lint-min: _clone-repo-tree-sitter configure-compile-database git ls-files '**.c' | \ grep -v 'parser\.c' | \ grep -v 'bindings/python' | \ - xargs -IFNAME sh -c 'echo "\nchecking file FNAME" && clang-tidy FNAME' + xargs -IFNAME sh -c 'echo "\nchecking file FNAME" && clang-tidy --std=c11 FNAME' # Run the linter for JS, C, Cargo, and Python. Requires clang-tidy, clippy, and ruff. lint: _lint-min diff --git a/src/scanner.c b/src/scanner.c index 4328dea..7746a80 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -25,8 +25,8 @@ #ifdef DEBUG_PRINT #define dbg_print(...) \ do { \ - fprintf(stderr, " \033[96;1mparse: \033[0m"); \ - fprintf(stderr, __VA_ARGS__); \ + fprintf_s(stderr, " \033[96;1mparse: \033[0m"); \ + fprintf_s(stderr, __VA_ARGS__); \ } while (0) #else #define dbg_print(...) @@ -34,9 +34,9 @@ #define panic(...) \ do { \ - fprintf(stderr, "panic at %s:%d: ", __FILE_NAME__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, "\n"); \ + fprintf_s(stderr, "panic at %s:%d: ", __FILE_NAME__, __LINE__); \ + fprintf_s(stderr, __VA_ARGS__); \ + fprintf_s(stderr, "\n"); \ exit(1); \ } while (0);