A review of the ChangeLog suggests we regressed on 'int **' at some
point, so it seems like a good idea to explicitly test this.
Also test int (*) because thought I had found an error but of course
the robot was correct and I was wrong: there was no such error.
Validate both the type name and declaration forms for each.
AT_BANNER([C declarations])
AT_BANNER([C declarations])
-m4_define([CHECK_DECL],
-[AT_DATA([expout], [[$2]m4_newline])
-AT_CHECK([cdecl99 -e 'explain $1'], [0], [expout])])
+m4_define([CHECK_DECLS],
+[AT_CHECK([cdecl99 m4_map_args_sep([-e 'explain ], ['], [ ], m4_shift($@))],
+ [0], [[$1]m4_ifval([$1], [
+])])])
-m4_define([SIMPLE_DECL],
-[AT_SETUP([$1])
-CHECK_DECL([$1], [$2])
+m4_define([SIMPLE_DECLS],
+[AT_SETUP([Accept m4_car($1)])
+CHECK_DECLS(m4_join([
+], $2), $1)
+m4_define([SIMPLE_DECL], [SIMPLE_DECLS([[$1]], [[$2]])])
+SIMPLE_DECLS([[int **], [int **x]],
+ [[type pointer to pointer to int],
+ [declare x as pointer to pointer to int]])
+SIMPLE_DECLS([[int (*x)], [int (*)]],
+ [[declare x as pointer to int],
+ [type pointer to int]])
SIMPLE_DECL([int (x*)], [type function (pointer to x) returning int])
SIMPLE_DECL([int (x*)], [type function (pointer to x) returning int])