blob: 97ffe9cdfeba0377737ee96680f5e331723868d4 [file] [log] [blame]
sewardj5cf515f2004-06-26 20:10:35 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
sewardj35421a32004-07-05 13:12:34 +00004/*--- This file (vex_util.h) is ---*/
sewardj5cf515f2004-06-26 20:10:35 +00005/*--- Copyright (c) 2004 OpenWorks LLP. All rights reserved. ---*/
6/*--- ---*/
7/*---------------------------------------------------------------*/
8
sewardj35421a32004-07-05 13:12:34 +00009#ifndef __VEX_UTIL_H
10#define __VEX_UTIL_H
sewardj5cf515f2004-06-26 20:10:35 +000011
sewardj887a11a2004-07-05 17:26:47 +000012#include "libvex_basictypes.h"
sewardj5cf515f2004-06-26 20:10:35 +000013
14
sewardj35421a32004-07-05 13:12:34 +000015/* Misc. */
16
17#define NULL ((void*)0)
18
19
sewardj5cf515f2004-06-26 20:10:35 +000020/* Stuff for panicking and assertion. */
21
22#define VG__STRING(__str) #__str
23
sewardj35421a32004-07-05 13:12:34 +000024#define vassert(expr) \
sewardj5cf515f2004-06-26 20:10:35 +000025 ((void) ((expr) ? 0 : \
26 (vex_assert_fail (VG__STRING(expr), \
27 __FILE__, __LINE__, \
28 __PRETTY_FUNCTION__), 0)))
29
30__attribute__ ((__noreturn__))
31extern void vex_assert_fail ( const Char* expr, const Char* file,
32 Int line, const Char* fn );
33__attribute__ ((__noreturn__))
sewardj35421a32004-07-05 13:12:34 +000034extern void vpanic ( Char* str );
sewardj5cf515f2004-06-26 20:10:35 +000035
36
sewardj35421a32004-07-05 13:12:34 +000037/* Printing */
38
39__attribute__ ((format (printf, 1, 2)))
sewardj41f43bc2004-07-08 14:23:22 +000040extern UInt vex_printf ( const Char *format, ... );
sewardj35421a32004-07-05 13:12:34 +000041
sewardj41f43bc2004-07-08 14:23:22 +000042__attribute__ ((format (printf, 2, 3)))
43extern UInt vex_sprintf ( Char* buf, const Char *format, ... );
sewardj35421a32004-07-05 13:12:34 +000044
45#endif /* ndef __VEX_UTIL_H */
sewardjac9af022004-07-05 01:15:34 +000046
47/*---------------------------------------------------------------*/
sewardj35421a32004-07-05 13:12:34 +000048/*--- vex_util.h ---*/
sewardjac9af022004-07-05 01:15:34 +000049/*---------------------------------------------------------------*/