-/* Renders the storage-class and function specifiers in canonical form. */
-static size_t explain_pre_specs(char *buf, size_t n, struct cdecl_declspec *s)
-{
- unsigned long funcmap = 0;
- const char *storage = NULL;
- size_t ret = 0;
-
- for (struct cdecl_declspec *c = s; c; c = c->next) {
- switch (cdecl_spec_kind(c)) {
- case CDECL_SPEC_FUNC:
- funcmap |= 1ul << (c->type & 0xff);
- break;
- case CDECL_SPEC_STOR:
- /* Valid C declarations have at most one
- * storage-class specifier. */
- storage = explain_storage(c->type);
- break;
+ rc = snprintf(buf, n, "function");
+ ret += cdecl__advance(&buf, &n, rc);
+
+ if (f->parameters) {
+ rc = snprintf(buf, n, "(");
+ ret += cdecl__advance_(&buf, &n, rc);
+
+ for (struct cdecl *p = f->parameters; p; p = p->next) {
+ rc = explain_decl(buf, n, p, false);
+ ret += cdecl__advance_(&buf, &n, rc);
+
+ if (p->next)
+ rc = snprintf(buf, n, ",");
+ else if (f->variadic)
+ rc = snprintf(buf, n, ", ...)");
+ else
+ rc = snprintf(buf, n, ")");
+ ret += cdecl__advance(&buf, &n, rc);