# _AT_UNUSED_VALUES_DECLARATIONS()
-# --------------------------------------------
+# --------------------------------
# Generate the token, type, and destructor
# declarations for the unused values tests.
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
%}
/* %{ and %} can be here too. */
#output "; /* "
*/
static size_t toknum;
- if (! (toknum < sizeof input))
- abort ();
+ assert (toknum < sizeof input);
yylval = value_as_yystype (input[toknum]);
return input[toknum++];
}
AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([-d -v -o input.c input.y])
-AT_COMPILE([input.o], [-c input.c])
-AT_COMPILE([main.o], [-c main.c])
+AT_COMPILE([input.o])
+AT_COMPILE([main.o])
AT_COMPILE([input], [input.o main.o])
AT_PARSER_CHECK([./input], 0,
[[[@<:@],
AT_BISON_CHECK([-o input.c input.y])
# Make sure we don't export silly token identifiers with periods or dashes.
-AT_COMPILE([input.o], [-c input.c])
+AT_COMPILE([input.o])
# Periods are genuine letters, they can start identifiers.
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
AT_CLEANUP
+
+
+## ------------------------------------------------------ ##
+## %name-prefix and %define api.prefix are incompatible. ##
+## ------------------------------------------------------ ##
+
+AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
+
+# AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
+# --------------------------------------------
+m4_pushdef([AT_TEST],
+[AT_DATA([[input.y]],
+[[$1
+%%
+exp:;
+]])
+AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
+[[$3: '%name-prefix' and '%define api.prefix' cannot be used together
+]])
+])
+
+AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
+AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:2])
+AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:2])
+AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
+
+m4_popdef([AT_TEST])
+
+AT_CLEANUP