bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50469: [bison-3.8] bug or side effect to flex & automake


From: Sam James
Subject: bug#50469: [bison-3.8] bug or side effect to flex & automake
Date: Fri, 10 Sep 2021 17:51:31 +0100


> On 10 Sep 2021, at 17:40, Akim Demaille <akim@lrde.epita.fr> wrote:
> 
> Hi all,
> 
>> Le 9 sept. 2021 à 07:10, Akim Demaille <akim@lrde.epita.fr> a écrit :
>> 
>> Hi!
>> 
>>> Le 9 sept. 2021 à 00:32, Paul Eggert <eggert@cs.ucla.edu> a écrit :
>>> 
>>> On 9/8/21 2:18 PM, Karl Berry wrote:
>>>> Just an idea that I don't expect you to adopt, but just to mention --
>>>> you could only institute the breaking change if POSIXLY_CORRECT.  That's
>>>> why POSIXLY_CORRECT exists. -k
>>> 
>>> I like this idea. It insulates us against POSIX decisions and/or 
>>> indecisions in this area.
>> 
>> Good with me.  I'll implement that, thanks Karl!
> 
> I will soon push the following commit, and wrap a 3.8.1.  Comments most 
> welcome!
> 
> Cheers!
> 
> (a tarball is available here:
> 
>  https://www.lrde.epita.fr/~akim/private/bison/bison-3.8.3-84b7.tar.gz
>  https://www.lrde.epita.fr/~akim/private/bison/bison-3.8.3-84b7.tar.lz
>  https://www.lrde.epita.fr/~akim/private/bison/bison-3.8.3-84b7.tar.xz)
> 
> [snip]

Thanks your work on this! Brief comments on version changes:

> diff --git a/src/getargs.c b/src/getargs.c
> index 697ad7eb..ef559296 100644
> --- a/src/getargs.c
> +++ b/src/getargs.c
> @@ -71,6 +71,18 @@ struct bison_language const *language = 
> &valid_languages[0];
> 
> typedef int* (xargmatch_fn) (const char *context, const char *arg);
> 
> +void
> +set_yacc (location loc)
> +{
> +  yacc_loc = loc;
> +  if (getenv ("POSIXLY_CORRECT"))
> +    muscle_percent_define_insert ("posix",
> +                                  loc,
> +                                  muscle_keyword, "",
> +                                  MUSCLE_PERCENT_DEFINE_D);
> +}
> +
> +
> /** Decode an option's key.
>  *
>  *  \param opt        option being decoded.
> @@ -631,8 +643,7 @@ static struct option const long_options[] =
> };
> 
> /* Build a location for the current command line argument. */
> -static
> -location
> +static location
> command_line_location (void)
> {
>   location res;
> @@ -835,7 +846,7 @@ getargs (int argc, char *argv[])
> 
>       case 'y':
>         warning_argmatch ("yacc", 0, 0);
> -        yacc_loc = loc;
> +        set_yacc (loc);
>         break;
> 
>       case COLOR_OPTION:
> diff --git a/src/getargs.h b/src/getargs.h
> index a26aec2f..836c1290 100644
> --- a/src/getargs.h
> +++ b/src/getargs.h
> @@ -140,6 +140,7 @@ void getargs (int argc, char *argv[]);
> /* Used by parse-gram.y.  */
> void language_argmatch (char const *arg, int prio, location loc);
> void skeleton_arg (const char *arg, int prio, location loc);
> +void set_yacc (location loc);
> 
> /** In the string \c s, replace all characters \c from by \c to.  */
> void tr (char *s, char from, char to);
> diff --git a/src/parse-gram.c b/src/parse-gram.c
> index 95fe43e0..3bc44dbd 100644
> --- a/src/parse-gram.c
> +++ b/src/parse-gram.c
> @@ -1,4 +1,4 @@
> -/* A Bison parser, made by GNU Bison 3.7.5.297-b46a.  */
> +/* A Bison parser, made by GNU Bison 3.8.  */

3.8 -> 3.8.1, but I guess this will be automatic :)

> 
> /* Bison implementation for Yacc-like parsers in C
> 
> @@ -46,10 +46,10 @@
>    USER NAME SPACE" below.  */
> 
> /* Identify Bison output, and Bison version.  */
> -#define YYBISON 30705
> +#define YYBISON 30800

Needs adjusting or not?

> 
> /* Bison version string.  */
> -#define YYBISON_VERSION "3.7.5.297-b46a"
> +#define YYBISON_VERSION "3.8"
> 

3.8.1?

> /* Skeleton name.  */
> #define YYSKELETON_NAME "yacc.c"
> @@ -3129,7 +3129,7 @@ handle_yacc (location const *loc)
>   const char *directive = "%yacc";
>   bison_directive (loc, directive);
>   if (location_empty (yacc_loc))
> -    yacc_loc = *loc;
> +    set_yacc (*loc);
>   else
>     duplicate_directive (directive, yacc_loc, *loc);
> }
> diff --git a/src/parse-gram.h b/src/parse-gram.h
> index 10a63528..77849263 100644
> --- a/src/parse-gram.h
> +++ b/src/parse-gram.h
> @@ -1,4 +1,4 @@
> -/* A Bison parser, made by GNU Bison 3.7.5.297-b46a.  */
> +/* A Bison parser, made by GNU Bison 3.8.  */
> 
> /* Bison interface for Yacc-like parsers in C
> 
> @@ -215,6 +215,7 @@ struct GRAM_LTYPE
> 
> 
> 
> +
> int gram_parse (void);
> 
> /* "%code provides" blocks.  */
> diff --git a/src/parse-gram.y b/src/parse-gram.y
> index 1de83d02..15180cb5 100644
> --- a/src/parse-gram.y
> +++ b/src/parse-gram.y
> @@ -1112,7 +1112,7 @@ handle_yacc (location const *loc)
>   const char *directive = "%yacc";
>   bison_directive (loc, directive);
>   if (location_empty (yacc_loc))
> -    yacc_loc = *loc;
> +    set_yacc (*loc);
>   else
>     duplicate_directive (directive, yacc_loc, *loc);
> }
> diff --git a/tests/calc.at b/tests/calc.at
> index 11801543..aeac8418 100644
> --- a/tests/calc.at
> +++ b/tests/calc.at
> @@ -268,7 +268,7 @@ m4_define([AT_CALC_YYLEX(c)],
> 
> 
> m4_define([_AT_DATA_CALC_Y(c)],
> -[AT_DATA_GRAMMAR([calc.y],
> +[AT_DATA_GRAMMAR([calc.y.tmp],
> [[/* Infix notation calculator--calc */
> ]$4[
> %code requires
> @@ -493,6 +493,18 @@ m4_define([_AT_DATA_CALC_Y(c)],
> [AT_CALC_YYLEX
> AT_CALC_MAIN])])
> 
> +# Remove the generated prototypes.
> +AT_CHECK(
> +  [AT_YACC_IF([[
> +    if "$POSIXLY_CORRECT_IS_EXPORTED"; then
> +      sed -e '/\/\* !POSIX \*\//d' calc.y.tmp >calc.y
> +    else
> +      mv calc.y.tmp calc.y
> +    fi
> +  ]],
> +  [[mv calc.y.tmp calc.y]])
> +])
> +
> AT_HEADER_IF([AT_DATA_SOURCE([[calc-lex.]AT_LANG_EXT],
> [[#include "calc.]AT_LANG_HDR["
> 
> diff --git a/tests/local.at b/tests/local.at
> index bc43ee1c..adde4e4c 100644
> --- a/tests/local.at
> +++ b/tests/local.at
> @@ -687,8 +687,8 @@ m4_define([AT_YYERROR_DECLARE_EXTERN(c)],
> m4_define([AT_YYERROR_DECLARE(c)],
> [[#include <stdio.h>
> ]AT_LOCATION_PRINT_DECLARE[
> -]AT_YACC_IF([], [[static ]AT_YYERROR_DECLARE_EXTERN])])
> -
> +/* !POSIX */ static ]AT_YYERROR_DECLARE_EXTERN[]dnl
> +])
> 
> # "%define parse.error custom" uses a different format, easy to check.
> # The "verbose" one can be computed from it (see _AT_CHECK_CALC_ERROR).
> @@ -733,7 +733,7 @@ m4_define([AT_YYERROR_DEFINE(c)],
> ]])[
> 
> /* A C error reporting function.  */
> -]AT_YACC_IF([], [static])[
> +/* !POSIX */ static
> ]AT_YYERROR_PROTOTYPE[
> {]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
>               [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [
> 
> 
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]