]> git.saurik.com Git - bison.git/blob - tests/c++.at
maint: update release instructions
[bison.git] / tests / c++.at
1 # Checking the output filenames. -*- Autotest -*-
2
3 # Copyright (C) 2004-2005, 2007, 2009-2012 Free Software Foundation,
4 # Inc.
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 AT_BANNER([[C++ Features.]])
20
21
22 ## ----------------------- ##
23 ## Doxygen Documentation. ##
24 ## ----------------------- ##
25
26 m4_define([AT_CHECK_DOXYGEN],
27 [m4_case([$1],
28 [Public], [m4_pushdef([AT_DOXYGEN_PRIVATE], [NO])],
29 [Private], [m4_pushdef([AT_DOXYGEN_PRIVATE], [YES])],
30 [m4_fatal([invalid argument: $1])])
31 AT_SETUP([Doxygen $1 Documentation])
32
33 AT_DATA([input.yy],
34 [[%skeleton "lalr1.cc"
35 %locations
36 %debug
37 %defines
38 %%
39 exp:;
40 %%
41 yy::parser::error (const location& l, const std::string& m)
42 {
43 std::cerr << l << s << std::endl;
44 }
45 ]])
46
47 AT_BISON_CHECK([-o input.cc input.yy], 0)
48
49 AT_DATA([Doxyfile],
50 [# The PROJECT_NAME tag is a single word (or a sequence of words
51 # surrounded by quotes) that should identify the project.
52 PROJECT_NAME = "Bison C++ Parser"
53
54 # The QUIET tag can be used to turn on/off the messages that are
55 # generated by doxygen. Possible values are YES and NO. If left blank
56 # NO is used.
57 QUIET = YES
58
59 # The WARNINGS tag can be used to turn on/off the warning messages
60 # that are generated by doxygen. Possible values are YES and NO. If
61 # left blank NO is used.
62 WARNINGS = YES
63 # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate
64 # warnings for undocumented members. If EXTRACT_ALL is set to YES then
65 # this flag will automatically be disabled.
66 WARN_IF_UNDOCUMENTED = YES
67 # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings
68 # for potential errors in the documentation, such as not documenting
69 # some parameters in a documented function, or documenting parameters
70 # that don't exist or using markup commands wrongly.
71 WARN_IF_DOC_ERROR = YES
72 # The WARN_FORMAT tag determines the format of the warning messages
73 # that doxygen can produce. The string should contain the $file,
74 # $line, and $text tags, which will be replaced by the file and line
75 # number from which the warning originated and the warning text.
76 WARN_FORMAT = "$file:$line: $text"
77
78 # If the EXTRACT_ALL tag is set to YES doxygen will assume all
79 # entities in documentation are documented, even if no documentation
80 # was available. Private class members and static file members will
81 # be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set
82 # to YES
83 EXTRACT_ALL = YES
84
85 # If the EXTRACT_PRIVATE tag is set to YES all private members of a
86 # class will be included in the documentation.
87 EXTRACT_PRIVATE = AT_DOXYGEN_PRIVATE
88
89 # If the EXTRACT_STATIC tag is set to YES all static members of a file
90 # will be included in the documentation.
91 EXTRACT_STATIC = AT_DOXYGEN_PRIVATE
92 ])
93
94 AT_CHECK([doxygen --version || exit 77], 0, ignore)
95 AT_CHECK([doxygen], 0, [], [ignore])
96
97 AT_CLEANUP
98
99 m4_popdef([AT_DOXYGEN_PRIVATE])
100 ])# AT_CHECK_DOXYGEN
101
102 AT_CHECK_DOXYGEN([Public])
103 AT_CHECK_DOXYGEN([Private])
104
105 ## ------------ ##
106 ## Namespaces. ##
107 ## ------------ ##
108
109 # AT_CHECK_NAMESPACE(NAMESPACE-DECL, [COMPILE-ERROR])
110 # ---------------------------------------------------
111 # See if Bison can handle %define namespace "NAMESPACE-DECL". If COMPILE-ERROR
112 # is specified, then Bison should accept the input, but compilation will fail,
113 # so don't check compilation.
114 m4_define([AT_CHECK_NAMESPACE],
115 [
116
117 AT_DATA_GRAMMAR([[input.y]],
118 [[%language "C++"
119 %defines
120 %define namespace "]$1["
121 %union { int i; }
122 %define global_tokens_and_yystype
123
124 %code {
125 // YYSTYPE contains a namespace reference.
126 int yylex (YYSTYPE *lval) {
127 lval->i = 3;
128 return 0;
129 }
130 }
131
132 %%
133
134 start: ;
135
136 %%
137
138 void
139 ]$1[::parser::error (const ]$1[::parser::location_type &loc,
140 const std::string &msg)
141 {
142 std::cerr << "At " << loc << ": " << msg << std::endl;
143 }
144
145 int
146 main (void)
147 {
148 ]$1[::parser p;
149 return p.parse ();
150 }
151 ]])
152
153 AT_BISON_CHECK([[-o input.cc input.y]])
154
155 m4_if([$#], [1],
156 [AT_COMPILE_CXX([[input]], [[input.cc]])
157 AT_PARSER_CHECK([[./input]])])
158
159 ])
160
161 AT_SETUP([[Relative namespace references]])
162 AT_CHECK_NAMESPACE([[foo]])
163 AT_CHECK_NAMESPACE([[foo::bar]])
164 AT_CHECK_NAMESPACE([[foo::bar::baz]])
165 AT_CLEANUP
166
167 AT_SETUP([[Absolute namespace references]])
168 AT_CHECK_NAMESPACE([[::foo]])
169 AT_CHECK_NAMESPACE([[::foo::bar]])
170 AT_CHECK_NAMESPACE([[::foo::bar::baz]])
171 AT_CHECK_NAMESPACE([[ ::foo]])
172 AT_CHECK_NAMESPACE([[ ::foo::bar]])
173 AT_CHECK_NAMESPACE([[ ::foo::bar::baz]])
174 AT_CLEANUP
175
176 AT_SETUP([[Syntactically invalid namespace references]])
177 AT_CHECK_NAMESPACE([[:foo:bar]], [[-]])
178 AT_CHECK_NAMESPACE([[foo: :bar]], [[-]])
179 # This one is interesting because `[3]' is encoded as `@<:@3@:>@', which
180 # contains single occurrences of `:'.
181 AT_CHECK_NAMESPACE([[foo[3]::bar::baz]], [[-]])
182 AT_CHECK_NAMESPACE([[foo::bar,baz]], [[-]])
183 AT_CHECK_NAMESPACE([[foo::bar::(baz]], [[-]])
184 AT_CLEANUP