]> git.draconx.ca Git - cdecl99.git/blob - tests/decl-good.at
Add a couple more positive tests.
[cdecl99.git] / tests / decl-good.at
1 # Copyright © 2020 Nick Bowler
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16 AT_BANNER([C declarations])
17
18 m4_define([CHECK_DECLS],
19 [AT_CHECK([cdecl99 m4_map_args_sep([-e 'explain ], ['], [ ], m4_shift($@))],
20   [0], [[$1]m4_ifval([$1], [
21 ])])])
22
23 m4_define([SIMPLE_DECLS],
24 [AT_SETUP([Accept m4_car($1)])
25 CHECK_DECLS(m4_join([
26 ], $2), $1)
27 AT_CLEANUP])
28 m4_define([SIMPLE_DECL], [SIMPLE_DECLS([[$1]], [[$2]])])
29
30 SIMPLE_DECLS([[int **], [int **x]],
31   [[type pointer to pointer to int],
32    [declare x as pointer to pointer to int]])
33 SIMPLE_DECLS([[int (*x)], [int (*)]],
34   [[declare x as pointer to int],
35    [type pointer to int]])
36 SIMPLE_DECL([int (x*)], [type function (pointer to x) returning int])