On 06/07/2018 10:48 AM, Markus Armbruster wrote: > Philippe Mathieu-Daudé <f4...@amsat.org> writes: > >> Hi, >> >> This series converts error_setg(&error_fatal) to error_report() + exit() as >> suggested by the "qapi/error.h" documentation. > > Appreciated! > > The series actually converts two anti-patterns. > > 1. From > > if (COND) { > error_setg(&error_fatal, ...); > } > > to > > if (COND) { > error_report(...); > exit(1); > } > > This is exactly what error.h asks for. > > 2. From > > if (COND) { > error_setg(&error_abort, ...); > } > to > > if (COND) { > error_report(...); > abort(); > } > > error.h asks for > > assert(!COND); > > instead. See my reply to PATCH 1 for why.
My bad, I misread your "error.h" explanation. These patterns are now cleaned from the codebase. Your examples are clearer and might be added in the header comments if we keep using the bad patterns. Regards, Phil.