From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from libra.cs.put.poznan.pl (libra.cs.put.poznan.pl [150.254.30.30]) (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 5F02443D4EA for ; Thu, 4 Jun 2026 12:44:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.254.30.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577069; cv=none; b=symw+rU45CQ3FX82iQ5QeOGEYHhShyj+cQmIIASZlydUV3MAiCjSfvGzLxiRKPUCRiA7iMYTsJD7KY3vquhT0QKLndXSvnjnoNZ8LjB20k36+Tfx2Fu8GAjV0WrzRYIYMeHM9YaPjxsMinl9UDGHWUJTDn/WdWhhyv1o4Flj+1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577069; c=relaxed/simple; bh=VTgDnk/C3A/z4mppCF8oQaPGl/u0uyHv8Ry0crTnnug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AhT7uukVsk3fQjQgwWcZd1/4+i61/+SKCgdpKJelof57mwSnioAptMy2pk1I+UIoNRFkUrNNBmUrq01N8e4QutSGjfUIXLwDjf6Q29U7c+k1XmJ28JtwHnePDXqYWT/R4XgD7ApoWJywSrppgM65OqqhZuz1EgwWdoZj308x5LA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cs.put.poznan.pl; spf=pass smtp.mailfrom=cs.put.poznan.pl; dkim=pass (2048-bit key) header.d=cs.put.poznan.pl header.i=@cs.put.poznan.pl header.b=lVnkHwfH; arc=none smtp.client-ip=150.254.30.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cs.put.poznan.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cs.put.poznan.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cs.put.poznan.pl header.i=@cs.put.poznan.pl header.b="lVnkHwfH" X-Virus-Scanned: Debian amavis at cs.put.poznan.pl Received: from libra.cs.put.poznan.pl ([150.254.30.30]) by localhost (meduza.cs.put.poznan.pl [150.254.30.40]) (amavis, port 10024) with ESMTP id QE1avbhrkHQU; Thu, 4 Jun 2026 12:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.put.poznan.pl; s=7168384; t=1780575858; bh=VTgDnk/C3A/z4mppCF8oQaPGl/u0uyHv8Ry0crTnnug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVnkHwfHS9IP4w8aI+nSAP+0K4o/NGdtPA0Vzoj5DZAxtLznJvqTuBzENofanlusl 4BmEV328BqIOFaWa59be9cEZAWF9nPzy+H+mnJ9ZAlxgzRAx4t85ZMP9XlRsrtKwMA MdlA00ESXVtvgsCCkIkQL+/If6+X/czCY92thnNRKJI/Swcjv67b3zPyVT5O4Yo+zX WSpFfNkgQ37xOfR+JYmyWRLBHJ0KCYFHujT3ieecQwiuSE8W8OnoBnPrmL66A1aOmh fQF4m5zTwPZfq01USlq4tJsAqfdd9nbez5JT+CaLfM99mODTGa6vwjiDPthtwylKII M8t21q+IjXnVQ== Received: from imladris.localnet (83.8.102.235.ipv4.supernova.orange.pl [83.8.102.235]) (Authenticated sender: jkonczak@libra.cs.put.poznan.pl) by libra.cs.put.poznan.pl (Postfix on VMS) with ESMTPSA id A300263D4A; Thu, 4 Jun 2026 14:34:58 +0200 (CEST) From: Jan =?UTF-8?B?S2/FhGN6YWs=?= To: Phil Sutter Cc: Florian Westphal , netfilter-devel@vger.kernel.org Subject: Re: [PATCH nft v2] parser_bison: on syntax errors, output expected tokens Date: Thu, 04 Jun 2026 14:34:55 +0200 Message-ID: <3901884.MHq7AAxBmi@imladris> Organization: Institute of Computing Science, =?UTF-8?B?UG96bmHFhA==?= University of Technology In-Reply-To: References: <20260120122954.18909-1-fw@strlen.de> <22975780.EfDdHjke4D@imladris> Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" > conditional setting of AM_YFLAGS variable in Makefile.am is problematic > (...) > what I tried was: > | AM_YFLAGS =3D -d -Wno-yacc > | =20 > | +if BISON_CUSTOM_ERROR > | +AM_YFLAGS +=3D =E2=80=A6 Any conditional change in Makefile.am I came up with is put aside by autotools. The lines "AM_YFLAGS +=3D ..." 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 >=3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/configure.ac b/configure.ac index 0d3ee2ac..9b61cd38 100644 =2D-- a/configure.ac +++ b/configure.ac @@ -45,6 +45,13 @@ then exit 1 fi =20 +AC_PATH_PROG([BISON],[bison]) +AX_PROG_BISON_VERSION([3.7.4],[ + AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=3Dcustom -D par= se.lac=3Dfull")]) +],[ + AC_SUBST([YACC], [$(echo "$ac_cv_prog_YACC -D parse.error=3Dverbose")]) +]) + AM_PROG_AR LT_INIT([disable-static]) AC_EXEEXT diff --git a/src/parser_bison.y b/src/parser_bison.y index 5a334bf0..25b875ec 100644 =2D-- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -221,8 +221,14 @@ int nft_lex(void *, void *, void *); %parse-param { void *scanner } %parse-param { struct parser_state *state } %lex-param { scanner } =2D%define parse.error custom =2D%define parse.lac full +// Note: configure.ac controls the following defines: +// if bison version is 3.7.4 or newer: +// %define parse.lac full +// %define parse.error custom +// else +// %define parse.error verbose +// Notice that bison 3.6 introduces parse.error custom, but starting from +// 3.7.4 a numeric macro enablkes checking version %locations =20 %initial-action { @@ -6537,6 +6543,7 @@ exthdr_key : HBH close_scope_hbh { $$ =3D IPPROTO_HO= POPTS; } =20 %% =20 +#if YYBISON >=3D 30704 static int yyreport_syntax_error(const yypcontext_t *yyctx, struct nft_ctx *nft, void *scanner, struct parser_state *state) @@ -6592,3 +6599,4 @@ yyreport_syntax_error(const yypcontext_t *yyctx, stru= ct nft_ctx *nft, free(msg); return 0; } +#endif