X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/3df85155e2dbf9307dd64bd222bf74389c45a75c..57510b6e4963ad39846a4f4c7fbd4ce7145f426d:/src/cdecl.h?ds=sidebyside diff --git a/src/cdecl.h b/src/cdecl.h index a8e9946..695024f 100644 --- a/src/cdecl.h +++ b/src/cdecl.h @@ -23,10 +23,10 @@ /* Declaration specifier kinds. */ enum { - CDECL_SPEC_TYPE = 0, - CDECL_SPEC_STOR = 256, - CDECL_SPEC_QUAL = 512, - CDECL_SPEC_FUNC = 1024, + CDECL_SPEC_TYPE = 256, + CDECL_SPEC_STOR = 512, + CDECL_SPEC_QUAL = 1024, + CDECL_SPEC_FUNC = 2048, }; enum { @@ -104,7 +104,15 @@ size_t cdecl_declare(char *buf, size_t n, struct cdecl *decl); static inline int cdecl_spec_kind(struct cdecl_declspec *spec) { - return spec->type & ~0xffu; + return spec->type & ~(CDECL_SPEC_TYPE-1u); +} + +static inline _Bool cdecl_is_abstract(struct cdecl_declarator *d) +{ + while (d->child) + d = d->child; + + return d->type != CDECL_DECL_IDENT; } /* Error handling. */