xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blktap2: use abort() instead of custom crash
@ 2016-04-26 13:04 Doug Goldstein
  2016-04-26 13:09 ` Andrew Cooper
  2016-04-26 13:15 ` Wei Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Doug Goldstein @ 2016-04-26 13:04 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Doug Goldstein

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>
---
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
-- 
2.7.3


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

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

end of thread, other threads:[~2016-04-26 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26 13:04 [PATCH] blktap2: use abort() instead of custom crash Doug Goldstein
2016-04-26 13:09 ` Andrew Cooper
2016-04-26 13:15 ` Wei Liu

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).