xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Doug Goldstein <cardoe@cardoe.com>, xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH] blktap2: use abort() instead of custom crash
Date: Tue, 26 Apr 2016 14:09:18 +0100	[thread overview]
Message-ID: <571F687E.5000508@citrix.com> (raw)
In-Reply-To: <1461675886-4275-1-git-send-email-cardoe@cardoe.com>

On 26/04/16 14:04, Doug Goldstein wrote:
> Instead of trying to write a snippet of code that crashes the process
> just use abort() directly. This is to fix the build on clang which
> detects that the snippet of code will crash and fails to compile. At
> the same time removed extraneous whitespace in the macro.
>
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

I definitely remember encountering this issue when trying to do clang
builds in the past.  I wonder where the patch went...

> ---
> Honestly this whole macro could get replaced with assert(3) but I wanted
> to make the smallest change possible. If that's preferrable I'll do that.
> The man page claims that assert(3) will print the following to stderr:
>
> "assertion \"%s\" failed: file \"%s\", line %d\n", \
>         "expression", __FILE__, __LINE__);
> ---
>  tools/blktap2/drivers/tapdisk-vbd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/blktap2/drivers/tapdisk-vbd.c b/tools/blktap2/drivers/tapdisk-vbd.c
> index 31bc2fe..e2e9cd5 100644
> --- a/tools/blktap2/drivers/tapdisk-vbd.c
> +++ b/tools/blktap2/drivers/tapdisk-vbd.c
> @@ -49,18 +49,18 @@
>  #define DBG(_level, _f, _a...) tlog_write(_level, _f, ##_a)
>  #define ERR(_err, _f, _a...) tlog_error(_err, _f, ##_a)
>  
> -#if 1                                                                        
> +#if 1
>  #define ASSERT(p)							\
>  	do {								\
>  		if (!(p)) {						\
>  			DPRINTF("Assertion '%s' failed, line %d, "	\
>  				"file %s", #p, __LINE__, __FILE__);	\
> -			*(int*)0 = 0;					\
> +			abort();					\
>  		}							\
>  	} while (0)
>  #else
>  #define ASSERT(p) ((void)0)
> -#endif 
> +#endif
>  
>  
>  #define TD_VBD_EIO_RETRIES          10


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-04-26 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 13:04 [PATCH] blktap2: use abort() instead of custom crash Doug Goldstein
2016-04-26 13:09 ` Andrew Cooper [this message]
2016-04-26 13:15 ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571F687E.5000508@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).