9 static int verify_specs(struct cdecl_declspec *s)
11 unsigned num_storage = 0;
12 unsigned long typemap;
14 typemap = cdecl__build_typemap(s);
18 for (struct cdecl_declspec *c = s; c; c = c->next) {
19 switch (cdecl_spec_kind(c)) {
23 if (++num_storage > 1) {
24 fprintf(stderr, "too many storage-class specifiers\n");
30 * Since we don't support pointer types yet, all
31 * restrict qualifiers are invalid. Other qualifiers
34 if (c->type == CDECL_QUAL_RESTRICT) {
35 fprintf(stderr, "only pointer types can be restrict-qualified.\n");
41 * Likewise for function specifiers.
43 fprintf(stderr, "only function declarations may have function specifiers.\n");
53 static int verify_decl(struct cdecl *decl)
55 return verify_specs(decl->specifiers);
58 struct cdecl *cdecl_parse_decl(const char *declstr)
60 YY_BUFFER_STATE state;
64 state = yy_scan_string(declstr);
66 yy_delete_buffer(state);
71 rc = verify_decl(decl);