From 46825d4978b63a0ae9637efbf6298220c833fa8d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 2 Feb 2014 12:51:14 -0500 Subject: [PATCH] Clean up some sloppy coding in repl_gram.y. Remove unused copy-and-pasted macro definitions, and improve formatting of recently-added productions. I got interested in this because buildfarm member protosciurus has been crashing in "bison repl_gram.y" since commit 858ec11. It's a long shot that this will fix that, though maybe the missing trailing semicolon has something to do with it? In any case, there's no need to approve of dead code, nor of code whose formatting isn't even self-consistent let alone consistent with what's around it. --- src/backend/replication/repl_gram.y | 49 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y index d4bd59bab2..c3f4a24a8f 100644 --- a/src/backend/replication/repl_gram.y +++ b/src/backend/replication/repl_gram.y @@ -25,14 +25,6 @@ /* Result of the parsing is returned here */ Node *replication_parse_result; -/* Location tracking support --- simpler than bison's default */ -#define YYLLOC_DEFAULT(Current, Rhs, N) \ - do { \ - if (N) \ - (Current) = (Rhs)[1]; \ - else \ - (Current) = (Rhs)[0]; \ - } while (0) /* * Bison doesn't allocate anything that needs to live across parser calls, @@ -45,9 +37,6 @@ Node *replication_parse_result; #define YYMALLOC palloc #define YYFREE pfree -#define parser_yyerror(msg) replication_yyerror(msg, yyscanner) -#define parser_errposition(pos) replication_scanner_errposition(pos) - %} %expect 0 @@ -91,6 +80,7 @@ Node *replication_parse_result; %type base_backup_opt %type opt_timeline %type opt_slot + %% firstcmd: command opt_semicolon @@ -134,34 +124,38 @@ base_backup: } ; -base_backup_opt_list: base_backup_opt_list base_backup_opt { $$ = lappend($1, $2); } - | /* EMPTY */ { $$ = NIL; } +base_backup_opt_list: + base_backup_opt_list base_backup_opt + { $$ = lappend($1, $2); } + | /* EMPTY */ + { $$ = NIL; } + ; base_backup_opt: K_LABEL SCONST { $$ = makeDefElem("label", - (Node *)makeString($2)); + (Node *)makeString($2)); } | K_PROGRESS { $$ = makeDefElem("progress", - (Node *)makeInteger(TRUE)); + (Node *)makeInteger(TRUE)); } | K_FAST { $$ = makeDefElem("fast", - (Node *)makeInteger(TRUE)); + (Node *)makeInteger(TRUE)); } | K_WAL { $$ = makeDefElem("wal", - (Node *)makeInteger(TRUE)); + (Node *)makeInteger(TRUE)); } | K_NOWAIT { $$ = makeDefElem("nowait", - (Node *)makeInteger(TRUE)); + (Node *)makeInteger(TRUE)); } ; @@ -214,7 +208,8 @@ opt_timeline: (errmsg("invalid timeline %u", $2)))); $$ = $2; } - | /* nothing */ { $$ = 0; } + | /* EMPTY */ + { $$ = 0; } ; /* @@ -237,14 +232,18 @@ timeline_history: } ; -opt_physical : K_PHYSICAL | /* EMPTY */; +opt_physical: + K_PHYSICAL + | /* EMPTY */ + ; +opt_slot: + K_SLOT IDENT + { $$ = $2; } + | /* EMPTY */ + { $$ = NULL; } + ; -opt_slot : K_SLOT IDENT - { - $$ = $2; - } - | /* nothing */ { $$ = NULL; } %% #include "repl_scanner.c" -- GitLab