From nobody Mon Jun 03 18:38:50 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMvD45RFz5JmxF for ; Mon, 03 Jun 2024 18:39:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMvD1g6Gz4Nlk for ; Mon, 3 Jun 2024 18:39:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-702621d8725so1896552b3a.0 for ; Mon, 03 Jun 2024 11:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1717439942; x=1718044742; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FMOngN7rN59iHpbSO6fqkGTVvdlsirZe3DyFj/TwqLk=; b=EMagEniVgROhxh+OpGdwdhoPP9tUzNrIXSIDkRxWwbHREbifsHnTDrXUi4XnuUJ9t7 1tN8Q8sdEt5J6XCTwOUx+s7u8eh436L8/v1uUmQ/rgtAdQVxGptRgdvXX0me2pr9xfHT /aAHXREJq8uxbDoPHA13Cc5Io6wWk9Cca2FacZqu2j6aCmR+L8A9eBcs59xWwYW6v0Cc TFhWRKLGa5eFmDhF7VVb/mlDnXTiuSoxlT5wxpGg9uwAXf08d2WoP3/IFCT0GFmI4hY+ 2JrKp2zIynf5HWMP1meaUT1RJsD/S1psk+W+KQjQ8GYWMzeXdD3LzII6GPb8rwod14tU kSuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717439942; x=1718044742; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FMOngN7rN59iHpbSO6fqkGTVvdlsirZe3DyFj/TwqLk=; b=K/fEBtqtNngZ1kur0mU0X3iA9K9MIfiIw8N5skXbpep93QIlruzo6hkIj1wZndIcGz uw4pJHeYPcr2MMeQleP+FjzfTYg7nLG8QUi58YZk5qJ5O3MxRMBX6KiFnlWKA73pguRn Xrjezai2yCApodVDez3YlkJpZsHYdq+xFWQDCWJp4WkCBPIlSm98iR2lRxcL0napy9On kYBcObknYynKVQWBPCjOY0I++DN84NNQTEUaDqAe7rCJh6+etn6WNGQkou+UG6/qB4Vn HXKsrD43ey8eB5Vit+GCqs/DR0nKo+Oji5v6xDabb5VQysxHBUnhzmvEKF4pCjC7vl3B /yyQ== X-Forwarded-Encrypted: i=1; AJvYcCX1rVOvYBQWIlMn8A7716OsasppZtdIjQoA+YfHoaqgwhTjrEC9Y7p5PNc8bRxIhrUHVgnVqSov4zvHOUmt1GHaCUz/9MLk7QdSQVv6Us5S X-Gm-Message-State: AOJu0YyxGTMn1B+WZ5Ue/zif4fZGz7RWO0h/QoGU0FVhE907XiJDWvAI fBUcGlSIBHmjqOQld+kCMnlRly1RraGZafcVr3UQIvbUBwSIQsJY3wp/y2pQUvQpMamuNOJZXNr 286SJcQisz7r4f5NbJyewAnRs5FOj3Vu9zkkZcA== X-Google-Smtp-Source: AGHT+IE7D3VbgNJNae0x4l3MjgJ9s7izDuKK2rqnXCNaXXX0wf1ie5vEjS5jn3KOGuFDOKF7ibEhHSQcMsEN1S32AxE= X-Received: by 2002:a05:6a20:4391:b0:1b1:f0d4:71b6 with SMTP id adf61e73a8af0-1b26f29ddc7mr11228813637.54.1717439942470; Mon, 03 Jun 2024 11:39:02 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202406031814.453IEsLL048613@gitrepo.freebsd.org> <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org> In-Reply-To: <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org> From: Warner Losh Date: Mon, 3 Jun 2024 12:38:50 -0600 Message-ID: Subject: Re: git: 5dda778db634 - main - Use correct function declaration for yyerror To: Jessica Clarke Cc: Warner Losh , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: multipart/alternative; boundary="000000000000b1cf4d061a00a59f" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4VtMvD1g6Gz4Nlk --000000000000b1cf4d061a00a59f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 3, 2024 at 12:19=E2=80=AFPM Jessica Clarke = wrote: > On 3 Jun 2024, at 19:14, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb131= 2a4981024 > > > > commit 5dda778db63407214394c3cf63fb1312a4981024 > > Author: Dapeng Gao > > AuthorDate: 2024-06-03 17:30:52 +0000 > > Commit: Warner Losh > > CommitDate: 2024-06-03 18:14:10 +0000 > > > > Use correct function declaration for yyerror > > > > 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. > > > > Reviewed by: imp, kib > > Differential Revision: https://reviews.freebsd.org/D45447 > > --- > > usr.sbin/config/config.y | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > 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; > > > > #define ns(s) strdup(s) > > int include(const char *, int); > > -void yyerror(const char *s); > > +int yyerror(const char *s); > > int yywrap(void); > > > > static void newdev(char *name); > > @@ -299,11 +299,13 @@ NoDevice: > > > > %% > > > > -void > > +int > > yyerror(const char *s) > > { > > > > 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. > OK. Wasn't sure, but you're comments remove all doubt in my mind. will fix. Warner --000000000000b1cf4d061a00a59f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, Jun 3, 2024 at 12:19=E2=80=AFPM J= essica Clarke <jrtc27@freebsd.org<= /a>> wrote:
O= n 3 Jun 2024, at 19:14, Warner Losh <imp@FreeBSD.org> wrote:
>
> The branch main has been updated by imp:
>
> URL:
https://= cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb1312a4981024<= /a>
>
> commit 5dda778db63407214394c3cf63fb1312a4981024
> Author:=C2=A0 =C2=A0 =C2=A0Dapeng Gao <
dg612@cam.ac.uk>
> AuthorDate: 2024-06-03 17:30:52 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-06-03 18:14:10 +0000
>
>=C2=A0 =C2=A0 Use correct function declaration for yyerror
>
>=C2=A0 =C2=A0 According to the POSIX standard at
>=C2=A0 =C2=A0 https://pubs.o= pengroup.org/onlinepubs/9699919799/utilities/yacc.html
>=C2=A0 =C2=A0 `yyerror` should return `int`. Add unreachable since errx= never returns.
>
>=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 imp, kib
>=C2=A0 =C2=A0 Differential Revision:=C2=A0 https://reviews.fre= ebsd.org/D45447
> ---
> usr.sbin/config/config.y | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> 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;
>
> #define ns(s) strdup(s)
> int include(const char *, int);
> -void yyerror(const char *s);
> +int yyerror(const char *s);
> int yywrap(void);
>
> static void newdev(char *name);
> @@ -299,11 +299,13 @@ NoDevice:
>
> %%
>
> -void
> +int
> yyerror(const char *s)
> {
>
> errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
> + __unreachable();
> + return (0);
> }

This should just be:

int
yyerror(const char *s)
{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 errx(1, "%s:%d: %s", yyfile, yyline += 1, s);
}

errx is __dead2. See bin/expr/expr.y for an example of this in-tree.

OK. Wasn't sure, but you're comments = remove all doubt in my mind. will fix.

Warner=C2= =A0
--000000000000b1cf4d061a00a59f--