From 5dda778db63407214394c3cf63fb1312a4981024 Mon Sep 17 00:00:00 2001 From: Dapeng Gao Date: Mon, 3 Jun 2024 11:30:52 -0600 Subject: [PATCH] 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); } int