Skip to content

Commit 0e720ea

Browse files
committed
Address jrgemignani review: keep -Werror, restore %expect budget
Reverts the broad `-Werror` drop and the no-%expect approach from the prior round on jrgemignani's request. The earlier framing — that conflict counts drift across Bison versions, so %expect is fragile — overcorrected: it removed the only build-time alarm bell for unintended new conflicts. Makefile: keep -Werror so any unexpected Bison warning (unused rules, undeclared types, etc.) still fails the build; downgrade only the two conflict categories to plain warnings via -Wno-error=conflicts-sr -Wno-error=conflicts-rr. pgxs auto-adds -Wno-deprecated, so existing %name-prefix= / %pure-parser directives remain non-erroring. cypher_gram.y: add `%expect 7` and `%expect-rr 3` matching the Bison 3.8.2 totals. Bison treats %expect as exact-match, not as a ceiling — any deviation fails the build and forces an audit of the new conflicts. Comment updated to reflect that future Bison versions reporting different counts should bump the numbers explicitly with a version note in the commit message, rather than removing the directive. No grammar or runtime change. Cassert installcheck 34/34 AGE tests green.
1 parent 960ce0b commit 0e720ea

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,14 @@ src/include/parser/cypher_gram_def.h: src/backend/parser/cypher_gram.c
229229
# GLR handles these correctly at runtime by forking at the conflict
230230
# point; %dprec annotations resolve cases where both forks succeed.
231231
#
232-
# We suppress the conflict warnings rather than hard-coding a conflict
233-
# budget with %expect / %expect-rr, because the exact counts vary across
234-
# Bison versions and would otherwise make the build fragile across
235-
# distros and future Bison releases.
232+
# We keep -Werror so any unexpected Bison warning (unused rules, undeclared
233+
# types, etc.) still fails the build; we downgrade only the two conflict
234+
# categories to plain warnings via -Wno-error=. The exact conflict totals
235+
# are pinned by %expect / %expect-rr in cypher_gram.y, which Bison treats
236+
# as exact-match: any deviation fails the build and forces an audit of
237+
# the new conflicts.
236238
#
237-
src/backend/parser/cypher_gram.c: BISONFLAGS += --defines=src/include/parser/cypher_gram_def.h -Wno-conflicts-sr -Wno-conflicts-rr
239+
src/backend/parser/cypher_gram.c: BISONFLAGS += --defines=src/include/parser/cypher_gram_def.h -Werror -Wno-error=conflicts-sr -Wno-error=conflicts-rr
238240

239241
src/backend/parser/cypher_parser.o: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h
240242
src/backend/parser/cypher_parser.bc: src/backend/parser/cypher_gram.c src/include/parser/cypher_gram_def.h

src/backend/parser/cypher_gram.y

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,21 @@
7171
* anonymous_path resolve cases where both forks succeed (bare (a)
7272
* prefers the expression interpretation).
7373
*
74-
* We intentionally do not use %expect / %expect-rr here because the
75-
* exact conflict counts can vary across Bison versions (and across
76-
* distros) as the generator's internals change. Instead, the Makefile
77-
* passes -Wno-conflicts-sr,-Wno-conflicts-rr via BISONFLAGS so the
78-
* build stays clean without binding us to a specific Bison release.
74+
* The %expect / %expect-rr counts below match the Bison-reported totals
75+
* (7 SR / 3 RR on Bison 3.8.2). Bison treats %expect as exact, not as
76+
* a ceiling: any deviation up or down fails the build. That is the
77+
* alarm bell — if a grammar change moves either count, the build stops
78+
* and the conflicts must be audited to confirm they remain the inherent
79+
* '(' expr ')' vs anonymous_path ambiguities (resolved by %dprec at
80+
* runtime) rather than an unintended new ambiguity. The Makefile
81+
* downgrades -Wconflicts-sr / -Wconflicts-rr from errors to warnings
82+
* (-Wno-error=conflicts-{sr,rr}) so %expect, not the warning category,
83+
* controls the build-fail threshold. If a future Bison version reports
84+
* different counts for the same grammar, update these numbers and note
85+
* the version in the commit message.
7986
*/
87+
%expect 7
88+
%expect-rr 3
8089

8190
%lex-param {ag_scanner_t scanner}
8291
%parse-param {ag_scanner_t scanner}

0 commit comments

Comments
 (0)