Re: [PATCH v8 06/15] bugreport: add compiler info
From: Junio C Hamano <hidden>
Date: 2020-02-21 00:26:11
Emily Shaffer [off-list ref] writes:
+ strbuf_addstr(sys_info, "compiler info: "); + get_compiler_info(sys_info); + strbuf_complete_line(sys_info);
Continuing the response to 04/15 review, I do not think this is a
good use of complete_line(), either. On an exotic platform you
haven't seen, get_compiler_info() might stuff nothing in the output
buffer, in which case we are left with an incomplete line that just
says "compiler info: ", and it might be better not to leave that
incomplete line hanging around by calling complete_line(), but an
even better solution would be to make sure get_compiler_info()
explicitly say it encountered a system totally new to it. And at
that point, as long as everybody in get_compiler_info() ends its
output with a complete line, there is no need for complete_line()
on the caller's side.
Of course, you can make it a convention that all case arms or ifdef
blocks in get_compiler_info() uniformly end what they have to say
with an incomplete line and make it a responsibility of the caller
to terminate the incomplete line. But in that case, you'd not be
using complete_line(), but strbuf_addch('\n').