struct cdecl *cdecl_parse_decl(const char *declstr)
{
YY_BUFFER_STATE state;
+ yyscan_t scanner;
struct cdecl *decl;
int rc;
- state = yy_scan_string(declstr);
- rc = yyparse(&decl);
- yy_delete_buffer(state);
+ rc = yylex_init(&scanner);
+ if (rc != 0)
+ return NULL;
+
+ state = yy_scan_string(declstr, scanner);
+ rc = yyparse(scanner, &decl);
+ yy_delete_buffer(state, scanner);
+ yylex_destroy(scanner);
if (rc != 0)
return NULL;
if (!valid_declspecs(i, true))
goto err;
+
+ if (is_abstract(i->declarators) && (i != decl || i->next)) {
+ fprintf(stderr, "mixing type names and declarations is not allowed\n");
+ goto err;
+ }
}
return decl;