]> git.draconx.ca Git - cdecl99.git/blobdiff - src/parse-decl.c
Make is_abstract a proper library function.
[cdecl99.git] / src / parse-decl.c
index 42931a3c866ada6229ce3212efb03421119a238e..5c8e6845afad1777f3f97f8e5876387fa19ae2dd 100644 (file)
 #include "i18n.h"
 #include "normalize.h"
 
-/*
- * Determine if a declarator declares an identifier (other than a function
- * parameter).
- */
-static bool is_abstract(struct cdecl_declarator *d)
-{
-       while (d->child)
-               d = d->child;
-
-       return d->type != CDECL_DECL_IDENT;
-}
-
 /*
  * Verify the declaration specifiers of a declaration.  If top is true, treat
  * this as a top-level declaration.  Otherwise, treat this as a function
@@ -48,7 +36,7 @@ static bool valid_declspecs(struct cdecl *decl, bool top)
 {
        struct cdecl_declspec *specs = decl->specifiers;
        struct cdecl_declarator *d   = decl->declarators;
-       bool abstract = is_abstract(d);
+       bool abstract = cdecl_is_abstract(d);
        unsigned num_storage = 0;
        unsigned long typemap;
 
@@ -456,7 +444,8 @@ struct cdecl *cdecl_parse_decl(const char *declstr)
                if (!valid_declspecs(i, true))
                        goto err;
 
-               if (is_abstract(i->declarators) && (i != decl || i->next)) {
+               if (cdecl_is_abstract(i->declarators)
+                   && (i != decl || i->next)) {
                        fprintf(stderr, "mixing type names and declarations is not allowed\n");
                        goto err;
                }