All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Kończak" <jan.konczak@cs.put.poznan.pl>
To: Phil Sutter <phil@nwl.cc>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v2] parser_bison: on syntax errors, output expected tokens
Date: Sat, 06 Jun 2026 13:37:01 +0200	[thread overview]
Message-ID: <2063352.yKVeVyVuyW@imladris> (raw)
In-Reply-To: <aiLr1JDG6oWbg7hS@orbyte.nwl.cc>

> Or am I missing some detail about YYBISON?

No, I don't think you're missing any detail there. I considered this
less intrusive than forcing a define in the configure.ac. Adding a C
macro BISON_CUSTOM_ERROR from configure is actually more versatile.


I just discovered that while autotools forbid conditional AM_YFLAGS,
they allow conditional YACC. It's counterintuitive to me why.
Yet, the following works in Makefile.am:

| if BISON_CUSTOM_ERROR
| YACC += -D parse.error=custom -D parse.lac=full
| AM_CFLAGS += -DBISON_CUSTOM_ERROR
| else
| YACC += -D parse.error=verbose
| endif

Then, the configure.ac has just to set the BISON_CUSTOM_ERROR, without
putting there the flags/define which nobody expects to be there.
To me this looks cleaner.


I guess adding a AC_ARG_ENABLE on that might be worthwhile, too.
Running "nft --debug parser ..." with parse.lac=full yields extra
output which one may or may not prefer if one wishes to debug
parser_bison.y. I mean, something akin to this:

| AC_ARG_ENABLE([custom_parser_errors],
|        AS_HELP_STRING(
|                [--disable-custom-parser-errors],
|                [Disable use of parse.error=custom and LAC in Bison]
|        ),[
|                # keeping the user choice for custom-parser-errors
|        ],[
|                enable_custom_parser_errors=no
|                AC_SUBST([BISON],[$ac_cv_prog_YACC])
|                AX_PROG_BISON_VERSION([3.6],
|                    [enable_custom_parser_errors=yes])
|        ]
| )
| AM_CONDITIONAL([BISON_CUSTOM_ERROR],
|                [test "x$enable_custom_parser_errors" != xno])


Regards, Jan



      reply	other threads:[~2026-06-06 11:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 12:29 [PATCH nft v2] parser_bison: on syntax errors, output expected tokens Florian Westphal
2026-01-20 17:33 ` Jan Kończak
2026-01-20 22:39   ` Florian Westphal
2026-06-03 20:23   ` Phil Sutter
2026-06-04 12:34     ` Jan Kończak
2026-06-05 15:31       ` Phil Sutter
2026-06-06 11:37         ` Jan Kończak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2063352.yKVeVyVuyW@imladris \
    --to=jan.konczak@cs.put.poznan.pl \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.