[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] parse-datetime: avoid "%pure-parser" deprecation warning fro
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH] parse-datetime: avoid "%pure-parser" deprecation warning from Bison 3.4 |
Date: |
Fri, 19 Jul 2019 09:45:07 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Hi Bruno,
On 7/19/19 5:03 AM, Bruno Haible wrote:
>> + parse-datetime: avoid "%pure-parser" deprecation warning from Bison 3.4
>
> I've pushed your change.
thanks.
> However, I think it would be good for "make" to behave reasonably when bison
> is not found or too old.
>
> Here's a proposed patch (untested so far):
I see 2 issues with this patch ...
> 2019-07-19 Bruno Haible <address@hidden>
>
> parse-datetime: Require Bison 2.7 or newer.
> * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Set PARSE_DATETIME_BISON.
> Code taken from gettext's intl.m4.
> * modules/parse-datetime (Makefile.am): Use PARSE_DATETIME_BISON instead
> of YACC.
>
> diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4
> index 597a44c..dd5e643 100644
> --- a/m4/parse-datetime.m4
> +++ b/m4/parse-datetime.m4
> @@ -1,4 +1,4 @@
> -# parse-datetime.m4 serial 22
> +# parse-datetime.m4 serial 23
> dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
> dnl This file is free software; the Free Software Foundation
> dnl gives unlimited permission to copy and/or distribute it,
> @@ -26,6 +26,37 @@ AC_DEFUN([gl_C_COMPOUND_LITERALS],
>
> AC_DEFUN([gl_PARSE_DATETIME],
> [
> + dnl parse-datetime.c is generated from parse-datetime.y. It requires bison,
> + dnl because parse-datetime.y uses bison specific features. It requires at
> + dnl least bison-2.7 for %define api.pure.
> + dnl bison is only needed for the maintainer (who touches parse-datetime.y).
> + dnl But in order to avoid separate Makefiles or --enable-maintainer-mode,
> + dnl we put the rule in general Makefile. Now, some people carelessly touch
> + dnl the files or have a broken "make" program, hence the parse-datetime.c
> + dnl rule will sometimes fire. To avoid an error, defines
> PARSE_DATETIME_BISON
> + dnl to ":" if it is not present or too old.
> + AC_CHECK_PROGS([PARSE_DATETIME_BISON], [bison])
> + if test -z "$PARSE_DATETIME_BISON"; then
> + ac_verc_fail=yes
> + else
> + dnl Found it, now check the version.
> + AC_MSG_CHECKING([version of bison])
> +changequote(<<,>>)dnl
> + ac_prog_version=`$PARSE_DATETIME_BISON --version 2>&1 | sed -n 's/^.*GNU
> Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
> + case $ac_prog_version in
> + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
> + 2.[7-9]* | [3-9].*)
This would run into a little problem in quite far future ...... when GNU Bison
reaches version 10.x. Maybe adjust to:
+ 2.[7-9]* | [3-9].* | [1-9][0-9].*)
?
> +changequote([,])dnl
> + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
> + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
> + esac
> + AC_MSG_RESULT([$ac_prog_version])
> + fi
> + if test $ac_verc_fail = yes; then
> + PARSE_DATETIME_BISON=:
> + fi
> + AC_SUBST([PARSE_DATETIME_BISON])
> +
> dnl Prerequisites of lib/parse-datetime.h.
> AC_REQUIRE([AM_STDBOOL_H])
> AC_REQUIRE([gl_TIMESPEC])
> diff --git a/modules/parse-datetime b/modules/parse-datetime
> index 692da25..d54dafd 100644
> --- a/modules/parse-datetime
> +++ b/modules/parse-datetime
> @@ -38,7 +38,7 @@ parse-datetime.c: parse-datetime.y
> y.tab.c parse-datetime.c \
> y.tab.h parse-datetime.h \
> y.output parse-datetime.output \
> - -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
> + -- $(PARSE_DATETIME_BISON) -y -d
> $(YFLAGS) $(AM_YFLAGS) && \
> sed -e 's|".*/parse-datetime.y"|"parse-datetime.y"|' \
> < parse-datetime.c > parse-datetime.c-t && \
> rm -f parse-datetime.c && \
>
During generation of parse-datetime.c, I'm getting these 2 new warnings:
/home/berny/coreutils/./lib/parse-datetime.y:568.1-7: warning: POSIX Yacc
does not support %define [-Wyacc]
568 | %define api.pure
| ^~~~~~~
/home/berny/coreutils/./lib/parse-datetime.y:573.1-7: warning: POSIX Yacc
does not support %expect [-Wyacc]
573 | %expect 31
| ^~~~~~~
Thanks & have a nice day,
Berny