1 # Bison Parser Headers. -*- Autotest -*-
2 # Copyright 2001 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 AT_BANNER([[Parser Headers.]])
22 ## ---------------------- ##
23 ## %union and --defines. ##
24 ## ---------------------- ##
27 AT_SETUP([%union and --defines])
39 AT_CHECK([bison --defines input.y])
45 ## --------------------- ##
46 ## Invalid CPP headers. ##
47 ## --------------------- ##
49 # AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE)
50 # -------------------------------------
51 m4_define([AT_TEST_CPP_GUARD_H],
52 [AT_SETUP([Invalid CPP guards: $1])
54 # Possibly create inner directories.
55 dirname=`AS_DIRNAME([$1])`
56 AS_MKDIR_P([$dirname])
58 AT_DATA_GRAMMAR([$1.y],
68 AT_CHECK([bison --defines=$1.h --output=y.tab.c $1.y])
70 # CPP should be happy with it.
71 AT_CHECK([$CC -E -I. y.tab.c], 0, [ignore])
76 AT_TEST_CPP_GUARD_H([input/input])
77 AT_TEST_CPP_GUARD_H([9foo])
81 ## ---------------- ##
83 ## ---------------- ##
86 AT_SETUP([export YYLTYPE])
88 AT_DATA_GRAMMAR([input.y],
103 my_error (const char *msg)
105 fprintf (stderr, "%s\n", msg);
113 AT_CHECK([bison --defines -o input.c input.y])
115 # YYLTYPE should be defined, and MY_LLOC declared.
118 YYLTYPE *my_llocp = &my_lloc;
129 # Link and execute, just to make sure everything is fine (and in
130 # particular, that MY_LLOC is indeed defined somewhere).
131 AT_COMPILE([caller.o], [-c caller.c])
132 AT_COMPILE([input.o], [-c input.c])
133 AT_COMPILE([caller], [caller.o input.o])
134 AT_PARSER_CHECK([./caller])