X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b7c49edf135cea5dc2bd0942b42d28e6c84cf71f..a9b8959efaa9aae4e2daf959d371765ac057e7f0:/tests/calc.at?ds=sidebyside diff --git a/tests/calc.at b/tests/calc.at index 49cf4e23..90241b35 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -63,9 +63,16 @@ static void yyungetc (int c); extern void perror (const char *s); %} +/* Also exercise %union. */ +%union +{ + int ival; /* A comment to exercise an old bug. */ +}; + /* Bison Declarations */ %token CALC_EOF 0 "end of file" -%token NUM "number" +%token NUM "number" +%type exp %nonassoc '=' /* comparison */ %left '-' '+' @@ -84,7 +91,7 @@ input: line: '\n' -| exp '\n' +| exp '\n' {} ; exp: @@ -205,7 +212,7 @@ yylex (void) if (c == '.' || isdigit (c)) { yyungetc (c); - yylval = read_signed_integer (); + yylval.ival = read_signed_integer (); return NUM; } @@ -344,17 +351,6 @@ AT_DATA_CALC_Y([$1]) AT_CHECK([bison calc.y -o calc.c m4_bpatsubst([$1], [--yyerror-verbose])], [0], [], []) -# Some compilers issue warnings we don't want to hear about. -# Maybe some day we will have proper Autoconf macros to disable these -# warnings, but this place is not the right one for that. -# So let's keep only GCC warnings, which we know are sane. -# Well, that's only part of the story: some assemblers issue warnings -# which can be totally useless, and actually polluting. It seems that -# the best bet be to completely ignore stderr, but to pass -Werror -# to GCC. -if test "$GCC" = yes; then - CFLAGS="$CFLAGS -Werror" -fi AT_CHECK([$CC $CFLAGS $CPPFLAGS calc.c -o calc], 0, [], [ignore]) # Test the priorities. @@ -371,7 +367,7 @@ _AT_CHECK_CALC([$1], 1 - (2 - 3) = 2 2^2^3 = 256 -(2^2)^3 = 64], [488]) +(2^2)^3 = 64], [486]) # Some parse errors. _AT_CHECK_CALC_ERROR([$1], [0 0], [10],