All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH build-fix v2 1/1] error: Don't use error_report() for assertion msgs.
@ 2014-01-15  3:37 Peter Crosthwaite
  2014-01-15  5:46 ` Edgar E. Iglesias
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Crosthwaite @ 2014-01-15  3:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: edgar.iglesias, kwolf, armbru, lcapitulino, aliguori, afaerber

Use fprintf(stderr instead. This removes dependency of libqemuutil.a
on the monitor.

We can further justify this change, in that this code path should only
trigger under a fatal error condition. fprintf-stderr is probably the
appropriate medium as under a fatal error conidition the monitor itself
may be down and out for the count. So assertion failure messages should
go lowest common denominator - straight to stderr.

Fixes the build as reported by Kevin Wolf. Issue debugged and change
suggested by Luiz Capitulino. Issue introduced by
5d24ee70bcbcf578614193526bcd5ed30a8eb16c.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
changed since v1:
Added "\n" (AF reivew)

 util/error.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/util/error.c b/util/error.c
index f11f1d5..e5de34f 100644
--- a/util/error.c
+++ b/util/error.c
@@ -44,7 +44,7 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)
     err->err_class = err_class;
 
     if (errp == &error_abort) {
-        error_report("%s", error_get_pretty(err));
+        fprintf(stderr, "%s\n", error_get_pretty(err));
         abort();
     }
 
@@ -80,7 +80,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
     err->err_class = err_class;
 
     if (errp == &error_abort) {
-        error_report("%s", error_get_pretty(err));
+        fprintf(stderr, "%s\n", error_get_pretty(err));
         abort();
     }
 
@@ -125,7 +125,7 @@ void error_set_win32(Error **errp, int win32_err, ErrorClass err_class,
     err->err_class = err_class;
 
     if (errp == &error_abort) {
-        error_report("%s", error_get_pretty(err));
+        fprintf(stderr, "%s\n", error_get_pretty(err));
         abort();
     }
 
@@ -171,7 +171,7 @@ void error_free(Error *err)
 void error_propagate(Error **dst_err, Error *local_err)
 {
     if (local_err && dst_err == &error_abort) {
-        error_report("%s", error_get_pretty(local_err));
+        fprintf(stderr, "%s\n", error_get_pretty(local_err));
         abort();
     } else if (dst_err && !*dst_err) {
         *dst_err = local_err;
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH build-fix v2 1/1] error: Don't use error_report() for assertion msgs.
  2014-01-15  3:37 [Qemu-devel] [PATCH build-fix v2 1/1] error: Don't use error_report() for assertion msgs Peter Crosthwaite
@ 2014-01-15  5:46 ` Edgar E. Iglesias
  0 siblings, 0 replies; 2+ messages in thread
From: Edgar E. Iglesias @ 2014-01-15  5:46 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: kwolf, armbru, qemu-devel, aliguori, lcapitulino, afaerber

On Tue, Jan 14, 2014 at 07:37:09PM -0800, Peter Crosthwaite wrote:
> Use fprintf(stderr instead. This removes dependency of libqemuutil.a
> on the monitor.
> 
> We can further justify this change, in that this code path should only
> trigger under a fatal error condition. fprintf-stderr is probably the
> appropriate medium as under a fatal error conidition the monitor itself
> may be down and out for the count. So assertion failure messages should
> go lowest common denominator - straight to stderr.
> 
> Fixes the build as reported by Kevin Wolf. Issue debugged and change
> suggested by Luiz Capitulino. Issue introduced by
> 5d24ee70bcbcf578614193526bcd5ed30a8eb16c.

Applied, thanks


> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> changed since v1:
> Added "\n" (AF reivew)
> 
>  util/error.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/util/error.c b/util/error.c
> index f11f1d5..e5de34f 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -44,7 +44,7 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)
>      err->err_class = err_class;
>  
>      if (errp == &error_abort) {
> -        error_report("%s", error_get_pretty(err));
> +        fprintf(stderr, "%s\n", error_get_pretty(err));
>          abort();
>      }
>  
> @@ -80,7 +80,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
>      err->err_class = err_class;
>  
>      if (errp == &error_abort) {
> -        error_report("%s", error_get_pretty(err));
> +        fprintf(stderr, "%s\n", error_get_pretty(err));
>          abort();
>      }
>  
> @@ -125,7 +125,7 @@ void error_set_win32(Error **errp, int win32_err, ErrorClass err_class,
>      err->err_class = err_class;
>  
>      if (errp == &error_abort) {
> -        error_report("%s", error_get_pretty(err));
> +        fprintf(stderr, "%s\n", error_get_pretty(err));
>          abort();
>      }
>  
> @@ -171,7 +171,7 @@ void error_free(Error *err)
>  void error_propagate(Error **dst_err, Error *local_err)
>  {
>      if (local_err && dst_err == &error_abort) {
> -        error_report("%s", error_get_pretty(local_err));
> +        fprintf(stderr, "%s\n", error_get_pretty(local_err));
>          abort();
>      } else if (dst_err && !*dst_err) {
>          *dst_err = local_err;
> -- 
> 1.8.5.3
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-15  6:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15  3:37 [Qemu-devel] [PATCH build-fix v2 1/1] error: Don't use error_report() for assertion msgs Peter Crosthwaite
2014-01-15  5:46 ` Edgar E. Iglesias

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.