]> git.draconx.ca Git - cdecl99.git/blobdiff - src/cdecl.h
Convert invalid declaration test to Autotest.
[cdecl99.git] / src / cdecl.h
index a8e994687ccc6dd02c84dcc783dac465364f1fbd..695024f5e8d63b9b9ada57e3b2db4b3170b89770 100644 (file)
 
 /* 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. */