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 if (!cdecl__typemap_is_valid(typemap)) {
19 fprintf(stderr, "conflicting type specifiers\n");
23 for (struct cdecl_declspec *c = s; c; c = c->next) {
24 switch (cdecl_spec_kind(c)) {
28 if (++num_storage > 1) {
29 fprintf(stderr, "too many storage-class specifiers\n");
35 * Since we don't support pointer types yet, all
36 * restrict qualifiers are invalid. Other qualifiers
39 if (c->type == CDECL_QUAL_RESTRICT) {
40 fprintf(stderr, "only pointer types can be restrict-qualified.\n");
46 * Likewise for function specifiers.
48 fprintf(stderr, "only function declarations may have function specifiers.\n");
58 static int verify_decl(struct cdecl *decl)
60 return verify_specs(decl->specifiers);
63 struct cdecl *cdecl_parse_decl(const char *declstr)
65 YY_BUFFER_STATE state;
69 state = yy_scan_string(declstr);
71 yy_delete_buffer(state);
76 rc = verify_decl(decl);