/*
- * Parse and validate C declarations.
- * Copyright © 2011-2012, 2020 Nick Bowler
+ * Parse and validate C declarations.
+ * Copyright © 2011-2012, 2020 Nick Bowler
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
#include <config.h>
#include <stdio.h>
#include <assert.h>
* new specifier list.
*/
norm_specs = cdecl__normalize_specs(decl->specifiers);
-
for (struct cdecl *i = decl; i; i = i->next) {
i->specifiers = norm_specs;
+ }
+ /* Now perform checks and simplifications on each declarator. */
+ for (struct cdecl *i = decl; i; i = i->next) {
if (!forall_declarators(i, reduce_parentheses))
goto err;
if (!forall_declarators(i, simplify_functions))
AT_BANNER([Invalid C declarations])
m4_define([CHECK_BADDECL],
- [AT_CHECK([if cdecl99 -e '$1'; then exit 1; fi], [0], [], [stderr])])
+ [AT_CHECK([cdecl99 -e '$1'], [1], [], [stderr])])
m4_define([SIMPLE_BADDECL],
[AT_SETUP([$1])
[explain int f, g((x))],
[explain int x, (void)],
[explain int [[5]], (void)])
+
+SIMPLE_BADDECL([Error recovery on multiple object declaration],
+ [explain int inline x, y])