X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/1402a14592dde378698373044afbcef9c38ec2c2..9cb5aae31e1c126970843ef9b6e54036b185fd51:/src/explain.c diff --git a/src/explain.c b/src/explain.c index 722e721..10a7064 100644 --- a/src/explain.c +++ b/src/explain.c @@ -67,16 +67,12 @@ explain_array(struct output_state *dst, struct cdecl_array *a) { size_t rc = 0; - if (a->vla) - cdecl__emit(dst, "variable-length "); - cdecl__emit(dst, "array "); - + cdecl__emit(dst, "variable-length array " + (a->vla ? 0 : 16)); if (a->vla) { rc = cdecl__emit(dst, a->vla); } else { rc = cdecl__emit_uint(dst, a->length); } - cdecl__emit(dst, " of " + !rc); } @@ -99,8 +95,9 @@ static void explain_decl(struct output_state *dst, struct cdecl *decl) static void explain_function(struct output_state *dst, struct cdecl_function *f) { - cdecl__emit(dst, "function "); + int tail_offset = 7; + cdecl__emit(dst, "function "); if (f->parameters) { struct cdecl *p; @@ -112,13 +109,9 @@ explain_function(struct output_state *dst, struct cdecl_function *f) cdecl__emit(dst, ", "); } - if (f->variadic) - cdecl__emit(dst, ", ...) "); - else - cdecl__emit(dst, ") "); + tail_offset = f->variadic ? 0 : 5; } - - cdecl__emit(dst, "returning "); + cdecl__emit(dst, ", ...) returning " + tail_offset); } static void