On Tue, Aug 16, 2016 at 04:45:13PM +0200, Markus Armbruster wrote: > Peter Xu <pet...@redhat.com> writes: > > > On Tue, Aug 16, 2016 at 08:19:08PM +0800, Fam Zheng wrote: > >> On Tue, 08/16 20:17, Peter Xu wrote: > >> > > Do we really need error_report_exit when we already have error_fatal? > >> > > >> > error_fatal is the name of a global var, not the function. > >> > >> I mean most error_report_exit(...) calls can be converted to > >> error_setg(&error_fatal, ...). > > > > Right. But it's just another way to implement error_report_fatal(). We > > may still need error_report_fatal() since it's cleaner and shorter > > than error_setg(&error_fatal, ...). > > Fam's point that > > error_report_fatal(...); > > is just another way to write > > error_setg(&error_fatal, ...) > > is valid. Your point that the former is shorter and simpler is also > valid. In fact, error.h advises: > > * Please don't error_setg(&error_fatal, ...), use error_report() and > * exit(), because that's more obvious. > * Likewise, don't error_setg(&error_abort, ...), use assert(). > > Could you convert the existing error_setg(&error_fatal, ...) to > error_report_fatal(...)? > > Regarding error_report_abort(): in my opinion, printing pretty messages > right before abort() is largely a waste of time. But if people insist > on doing it, then the error subsystem may have to support it. Would you > be willing to track down such usage, so we can make an informed > decision?
Sure. :) Yes I see usages for error_setg(&error_abort, ...), it makes sense to provide error_report_abort() along with error_report_fatal(). Will take your (and Fam's) advice. Thanks for your comments! -- peterx