Received: from orbyte.nwl.cc (orbyte.nwl.cc [151.80.46.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E01FB2F7EE4 for ; Fri, 5 Jun 2026 15:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=151.80.46.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780673503; cv=none; b=ShnB8RGB8eMPAI39DPTCirOax2/Rvhgqf6AiUGLaV/5WpUU2Fiu9B/3GYkZybR9k3MLUsAj7Dgc5cMbrulqtj5JKZdcdKpz2zU+VhxDE0FtinNqkGWh6H0SqReMwditzd9/hIOuApJT8XwqjByzxg7lcpQyaRdLLBa0T4qCcQv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780673503; c=relaxed/simple; bh=FPExOuNMDcjlV3emJdqdXRDFGzuNVQrsHDGFjKNVvl0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UcWSyhewETzkk6/hFbGqwb2TBHHbkSXpA94BedU1/tV+1f+biBVnlhZCh942u73VwIyW36bKqhz2vyW6p4PaSBRey0kBkPJYQ8lW0mjrQ/9Ki+JK0R1i1ybS5o5SvKA0cHgcCh3p8WvtGOcFTnbiqroVT2e8qFu1XL2tl1eov8E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nwl.cc; spf=pass smtp.mailfrom=nwl.cc; dkim=pass (2048-bit key) header.d=nwl.cc header.i=@nwl.cc header.b=mhDDOa//; arc=none smtp.client-ip=151.80.46.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nwl.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nwl.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nwl.cc header.i=@nwl.cc header.b="mhDDOa//" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nwl.cc; s=mail2022; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+22VABFUBwc0oZKcrAw75LBp5amO7nAWZogF/yNn4HY=; b=mhDDOa//H0eojglxTLEXwO51vA VpWkavef+Pnp4E61EdbAo50JP3AILZHJyFJ8R0QSiOUYdJ6dBZO5u3VSgqNcpvrPUuckOPc7sC/1o +3dV3oV8ENddtNfaChfbCyvYuNJ4zGYv7zCptFHjU7q4+4QXqREjiNpmMUe5OYNh70AzcEHDDwNNl YIwNcGp4qLLcGzpYSmrXj3iISXzPGJwtxIV1o7jhFe+9Zw/iRfuSB2fdz2E9supZHyxGiyQB8faoV QPGoOMH2kOi/TfsZI8ayjxgQ/u2gYRJjaUactp5EcYNcBEGrR7GdB3OYG7hX4pM9d+l4r4x0zemAJ MIa6+ilQ==; Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.98.2) (envelope-from ) id 1wVWWC-000000004rZ-2AIx; Fri, 05 Jun 2026 17:31:32 +0200 Date: Fri, 5 Jun 2026 17:31:32 +0200 From: Phil Sutter To: Jan =?utf-8?Q?Ko=C5=84czak?= Cc: Florian Westphal , netfilter-devel@vger.kernel.org Subject: Re: [PATCH nft v2] parser_bison: on syntax errors, output expected tokens Message-ID: References: <20260120122954.18909-1-fw@strlen.de> <22975780.EfDdHjke4D@imladris> <3901884.MHq7AAxBmi@imladris> Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3901884.MHq7AAxBmi@imladris> Hi Jan, On Thu, Jun 04, 2026 at 02:34:55PM +0200, Jan Kończak wrote: > > conditional setting of AM_YFLAGS variable in Makefile.am is problematic > > (...) > > what I tried was: > > | AM_YFLAGS = -d -Wno-yacc > > | > > | +if BISON_CUSTOM_ERROR > > | +AM_YFLAGS += … > > Any conditional change in Makefile.am I came up with is put aside by > autotools. The lines "AM_YFLAGS += ..." end up in a ".PRECIOUS" target > in the resulting Makefile and are never applied before bison is called. > > I guess moving the %define's from parser_bison.y to bison command line > arguments, and a '#if YYBISON >= 30704' that disables the error > reporting code is a way to go, one only must subdue the autotools. > The YYBISON macro generated by bison has the version encoded starting > from 3.7.4, hence that particular version. > > My (working) take on that would be as follows, though I can tell that > mangling the options in configure.ac is a shitty workaround. I never > really wrote autotools configs myself, and I don't have a clue how to > do it better. Feel free to include any part of it in case it helps. > > Regards, Jan > > ==================================================================== > diff --git a/configure.ac b/configure.ac > index 0d3ee2ac..9b61cd38 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -45,6 +45,13 @@ then > exit 1 > fi > > +AC_PATH_PROG([BISON],[bison]) > +AX_PROG_BISON_VERSION([3.7.4],[ > + AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=custom -D parse.lac=full")]) > +],[ > + AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=verbose")]) > +]) > + Ah, modifying the "command" didn't come to mind. Doing that is usually error-prone Since scripts may start searching for 'mycmd --option' in $PATH and what not. I'd go with it for lack of alternatives, though. My (uglier) variant is: | have_bison_3_6=no | AC_PATH_PROG([BISON], [bison]) | AX_PROG_BISON_VERSION([3.6], [ | have_bison_3_6=yes | AC_DEFINE([BISON_CUSTOM_ERROR], [1], | [Define to use parse.error=custom in Bison]) | ]) | AM_CONDITIONAL([BISON_CUSTOM_ERROR], [test "x$have_bison_3_6" != xno]) This is me failing to find a macro which creates both a variable to test against for Makefile.am and a preprocessor macro. I guess one may join the two into: | AC_PATH_PROG([BISON],[bison]) | AX_PROG_BISON_VERSION([3.6], [ | AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=custom -D parse.lac=full")]) | AC_DEFINE([HAVE_BISON_CUSTOM_ERROR], [1], [Define to use parse.error=custom in Bison]) | ], [ | AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=verbose")]) | ]) Then, one would wrap yyreport_syntax_error into '#ifdef HAVE_BISON_CUSTOM_ERROR'. Or am I missing some detail about YYBISON? Thanks, Phil