Date: Mon, 3 Jun 2024 19:19:44 +0100 From: Jessica Clarke <jrtc27@freebsd.org> To: Warner Losh <imp@FreeBSD.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: 5dda778db634 - main - Use correct function declaration for yyerror Message-ID: <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org> In-Reply-To: <202406031814.453IEsLL048613@gitrepo.freebsd.org> References: <202406031814.453IEsLL048613@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 3 Jun 2024, at 19:14, Warner Losh <imp@FreeBSD.org> wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb1312= a4981024 >=20 > commit 5dda778db63407214394c3cf63fb1312a4981024 > Author: Dapeng Gao <dg612@cam.ac.uk> > AuthorDate: 2024-06-03 17:30:52 +0000 > Commit: Warner Losh <imp@FreeBSD.org> > CommitDate: 2024-06-03 18:14:10 +0000 >=20 > Use correct function declaration for yyerror >=20 > According to the POSIX standard at > = https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html > `yyerror` should return `int`. Add unreachable since errx never = returns. >=20 > Reviewed by: imp, kib > Differential Revision: https://reviews.freebsd.org/D45447 > --- > usr.sbin/config/config.y | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y > index a5a9e1546c36..148959fbff2e 100644 > --- a/usr.sbin/config/config.y > +++ b/usr.sbin/config/config.y > @@ -88,7 +88,7 @@ int maxusers; >=20 > #define ns(s) strdup(s) > int include(const char *, int); > -void yyerror(const char *s); > +int yyerror(const char *s); > int yywrap(void); >=20 > static void newdev(char *name); > @@ -299,11 +299,13 @@ NoDevice: >=20 > %% >=20 > -void > +int > yyerror(const char *s) > { >=20 > errx(1, "%s:%d: %s", yyfile, yyline + 1, s); > + __unreachable(); > + return (0); > } This should just be: int yyerror(const char *s) { errx(1, "%s:%d: %s", yyfile, yyline + 1, s); } errx is __dead2. See bin/expr/expr.y for an example of this in-tree. Jess
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318>