tree-sitter / tree-sitter

An incremental parsing system for programming tools

Home Page:https://tree-sitter.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling generated grammar `parser.c` files with `-pedantic` throws a warning about `REDUCE()`

DavisVaughan opened this issue · comments

Problem

I noticed that a little while back you fixed all the -pedantic issues in tree-sitter itself, and I really appreciate that!

I noticed that in generated parser.c files, there is still a remaining -pedantic issue. You typically see lots of these:

   parser.c:383074:100: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
     [6681] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_function_definition_repeat1, 2), SHIFT_REPEAT(2561),
                                                                                                      ^
   ./tree_sitter/parser.h:206:9: note: macro 'REDUCE' defined here
   #define REDUCE(symbol_val, child_count_val, ...) \
           ^

Steps to reproduce

Try compiling any parser.c with -pedantic

Expected behavior

No warnings during -pedantic compilation hopefully.

Maybe you could introduce REDUCE(symbol_val, child_count_val) and REDUCE_ARGS(symbol_val, child_count_val, ...)? It's unfortunate that you'd have to do that, but I'm not sure I see an easy way around it

Tree-sitter version (tree-sitter --version)

tree-sitter 0.21.0

Operating system/version

macOS 13.6.5