There is not a strong reason for an assert here. With the assertion
removed, the consequence of an unexpected declarator type is that
nothing will be output for that declarator. This is an acceptable
behaviour in and of itself, so let's just go with that.
#include "cdecl.h"
#include "cdecl-internal.h"
#include "cdecl.h"
#include "cdecl-internal.h"
declare_postfix_child(dst, d->child);
declare_function(dst, &d->u.function);
return;
declare_postfix_child(dst, d->child);
declare_function(dst, &d->u.function);
return;
/*
* Render C declarations as English.
/*
* Render C declarations as English.
- * Copyright © 2011, 2021, 2023 Nick Bowler
+ * Copyright © 2011, 2021, 2023-2024 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "cdecl.h"
#include "cdecl-internal.h"
#include "cdecl.h"
#include "cdecl-internal.h"
static void
explain_declarators(struct output_state *dst, struct cdecl_declarator *d)
{
static void
explain_declarators(struct output_state *dst, struct cdecl_declarator *d)
{
- if (d->type == CDECL_DECL_IDENT || d->type == CDECL_DECL_NULL)
- return;
-
- explain_declarators(dst, d->child);
+ if (d->child)
+ explain_declarators(dst, d->child);
switch (d->type) {
case CDECL_DECL_POINTER:
switch (d->type) {
case CDECL_DECL_POINTER:
case CDECL_DECL_FUNCTION:
explain_function(dst, &d->u.function);
return;
case CDECL_DECL_FUNCTION:
explain_function(dst, &d->u.function);
return;