From 5a59f19b694993dbe841220e6b56508322201236 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 21 Mar 2019 16:06:06 -0700 Subject: [PATCH] Use explicit syntax for functions with no parameters --- cli/src/generate/render.rs | 4 ++-- lib/include/tree_sitter/api.h | 2 +- lib/include/tree_sitter/parser.h | 2 +- lib/src/clock.h | 12 ++++++------ lib/src/length.h | 2 +- lib/src/node.c | 2 +- lib/src/parser.c | 2 +- lib/src/reusable_node.h | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cli/src/generate/render.rs b/cli/src/generate/render.rs index 86ed3dc7..644e74d3 100644 --- a/cli/src/generate/render.rs +++ b/cli/src/generate/render.rs @@ -713,7 +713,7 @@ impl Generator { let external_scanner_name = format!("{}_external_scanner", language_function_name); if !self.syntax_grammar.external_tokens.is_empty() { - add_line!(self, "void *{}_create();", external_scanner_name); + add_line!(self, "void *{}_create(void);", external_scanner_name); add_line!(self, "void {}_destroy(void *);", external_scanner_name); add_line!( self, @@ -740,7 +740,7 @@ impl Generator { add_line!( self, - "extern const TSLanguage *{}() {{", + "extern const TSLanguage *{}(void) {{", language_function_name ); indent!(self); diff --git a/lib/include/tree_sitter/api.h b/lib/include/tree_sitter/api.h index cfc5393d..2f576d87 100644 --- a/lib/include/tree_sitter/api.h +++ b/lib/include/tree_sitter/api.h @@ -77,7 +77,7 @@ typedef struct { uint32_t context[2]; } TSTreeCursor; -TSParser *ts_parser_new(); +TSParser *ts_parser_new(void); void ts_parser_delete(TSParser *); const TSLanguage *ts_parser_language(const TSParser *); bool ts_parser_set_language(TSParser *, const TSLanguage *); diff --git a/lib/include/tree_sitter/parser.h b/lib/include/tree_sitter/parser.h index e5037062..d7365c11 100644 --- a/lib/include/tree_sitter/parser.h +++ b/lib/include/tree_sitter/parser.h @@ -92,7 +92,7 @@ struct TSLanguage { struct { const bool *states; const TSSymbol *symbol_map; - void *(*create)(); + void *(*create)(void); void (*destroy)(void *); bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); unsigned (*serialize)(void *, char *); diff --git a/lib/src/clock.h b/lib/src/clock.h index 2792febb..50656273 100644 --- a/lib/src/clock.h +++ b/lib/src/clock.h @@ -26,11 +26,11 @@ static inline uint64_t duration_to_micros(TSDuration self) { return self * 1000000 / (uint64_t)frequency.QuadPart; } -static inline TSClock clock_null() { +static inline TSClock clock_null(void) { return 0; } -static inline TSClock clock_now() { +static inline TSClock clock_now(void) { LARGE_INTEGER result; QueryPerformanceCounter(&result); return (uint64_t)result.QuadPart; @@ -68,13 +68,13 @@ static inline uint64_t duration_to_micros(TSDuration self) { return self; } -static inline TSClock clock_now() { +static inline TSClock clock_now(void) { TSClock result; clock_gettime(CLOCK_MONOTONIC, &result); return result; } -static inline TSClock clock_null() { +static inline TSClock clock_null(void) { return (TSClock) {0, 0}; } @@ -116,11 +116,11 @@ static inline uint64_t duration_to_micros(TSDuration self) { return self * 1000000 / (uint64_t)CLOCKS_PER_SEC; } -static inline TSClock clock_null() { +static inline TSClock clock_null(void) { return 0; } -static inline TSClock clock_now() { +static inline TSClock clock_now(void) { return (uint64_t)clock(); } diff --git a/lib/src/length.h b/lib/src/length.h index ffe0c7f4..61de9fc1 100644 --- a/lib/src/length.h +++ b/lib/src/length.h @@ -36,7 +36,7 @@ static inline Length length_sub(Length len1, Length len2) { return result; } -static inline Length length_zero() { +static inline Length length_zero(void) { Length result = {0, {0, 0}}; return result; } diff --git a/lib/src/node.c b/lib/src/node.c index eb4a3121..b4048811 100644 --- a/lib/src/node.c +++ b/lib/src/node.c @@ -22,7 +22,7 @@ TSNode ts_node_new(const TSTree *tree, const Subtree *subtree, Length position, }; } -static inline TSNode ts_node__null() { +static inline TSNode ts_node__null(void) { return ts_node_new(NULL, NULL, length_zero(), 0); } diff --git a/lib/src/parser.c b/lib/src/parser.c index 3937bd64..f83ae6da 100644 --- a/lib/src/parser.c +++ b/lib/src/parser.c @@ -1501,7 +1501,7 @@ static bool ts_parser_has_outstanding_parse(TSParser *self) { // Parser - Public -TSParser *ts_parser_new() { +TSParser *ts_parser_new(void) { TSParser *self = ts_calloc(1, sizeof(TSParser)); ts_lexer_init(&self->lexer); array_init(&self->reduce_actions); diff --git a/lib/src/reusable_node.h b/lib/src/reusable_node.h index ab91cb36..9cba9519 100644 --- a/lib/src/reusable_node.h +++ b/lib/src/reusable_node.h @@ -11,7 +11,7 @@ typedef struct { Subtree last_external_token; } ReusableNode; -static inline ReusableNode reusable_node_new() { +static inline ReusableNode reusable_node_new(void) { return (ReusableNode) {array_new(), NULL_SUBTREE}; }