+
+/*
+ * Join three specifier lists into a single list, and returns the head of
+ * the new list.
+ *
+ * The list "b" is assumed to be a singleton list.
+ */
+static struct cdecl_declspec *join_specs3(struct cdecl_declspec *a,
+ struct cdecl_declspec *b,
+ struct cdecl_declspec *c)
+{
+ b->next = c;
+ join_specs(b, a);
+ return b;
+}
+
+/*
+ * Reverse the order of a "struct cdecl" list, and return the new first
+ * element of the list (i.e., the last element of the original list).
+ */
+static struct cdecl *reverse_decls(struct cdecl *decl)
+{
+ struct cdecl *prev, *next;
+
+ for (prev = NULL; decl; decl = next) {
+ next = decl->next;
+ decl->next = prev;
+ prev = decl;
+ }
+
+ return prev;
+}
+
+/*
+ * Alter an abstract declarator (type name) to declare an identifier instead,
+ * used by the English parser rules to reduce "identifier as type" sequences.
+ */
+static struct cdecl *
+insert_identifier(struct cdecl *decl, struct parse_item *ident)
+{
+ struct cdecl_declarator *d, **p = &decl->declarators;
+
+ while ((d = *p)->child)
+ p = &d->child;
+
+ *p = &ident->u.declarator;
+ return decl;
+}
+
+static struct cdecl_declarator *nulldecl(void)
+{
+ static const struct cdecl_declarator nulldecl = {0};
+ return (void *)&nulldecl;
+}
+#define NULLDECL (nulldecl())
+