1132bfccd21960e462352175f8553a5bdce8a210cnjn
2132bfccd21960e462352175f8553a5bdce8a210cnjn/*--------------------------------------------------------------------*/
3132bfccd21960e462352175f8553a5bdce8a210cnjn/*--- Assertions, etc.                       pub_tool_libcassert.h ---*/
4132bfccd21960e462352175f8553a5bdce8a210cnjn/*--------------------------------------------------------------------*/
5132bfccd21960e462352175f8553a5bdce8a210cnjn
6132bfccd21960e462352175f8553a5bdce8a210cnjn/*
7132bfccd21960e462352175f8553a5bdce8a210cnjn   This file is part of Valgrind, a dynamic binary instrumentation
8132bfccd21960e462352175f8553a5bdce8a210cnjn   framework.
9132bfccd21960e462352175f8553a5bdce8a210cnjn
10b3a1e4bffbdbbf38304f216af405009868f43628sewardj   Copyright (C) 2000-2015 Julian Seward
11132bfccd21960e462352175f8553a5bdce8a210cnjn      jseward@acm.org
12132bfccd21960e462352175f8553a5bdce8a210cnjn
13132bfccd21960e462352175f8553a5bdce8a210cnjn   This program is free software; you can redistribute it and/or
14132bfccd21960e462352175f8553a5bdce8a210cnjn   modify it under the terms of the GNU General Public License as
15132bfccd21960e462352175f8553a5bdce8a210cnjn   published by the Free Software Foundation; either version 2 of the
16132bfccd21960e462352175f8553a5bdce8a210cnjn   License, or (at your option) any later version.
17132bfccd21960e462352175f8553a5bdce8a210cnjn
18132bfccd21960e462352175f8553a5bdce8a210cnjn   This program is distributed in the hope that it will be useful, but
19132bfccd21960e462352175f8553a5bdce8a210cnjn   WITHOUT ANY WARRANTY; without even the implied warranty of
20132bfccd21960e462352175f8553a5bdce8a210cnjn   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21132bfccd21960e462352175f8553a5bdce8a210cnjn   General Public License for more details.
22132bfccd21960e462352175f8553a5bdce8a210cnjn
23132bfccd21960e462352175f8553a5bdce8a210cnjn   You should have received a copy of the GNU General Public License
24132bfccd21960e462352175f8553a5bdce8a210cnjn   along with this program; if not, write to the Free Software
25132bfccd21960e462352175f8553a5bdce8a210cnjn   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26132bfccd21960e462352175f8553a5bdce8a210cnjn   02111-1307, USA.
27132bfccd21960e462352175f8553a5bdce8a210cnjn
28132bfccd21960e462352175f8553a5bdce8a210cnjn   The GNU General Public License is contained in the file COPYING.
29132bfccd21960e462352175f8553a5bdce8a210cnjn*/
30132bfccd21960e462352175f8553a5bdce8a210cnjn
31132bfccd21960e462352175f8553a5bdce8a210cnjn#ifndef __PUB_TOOL_LIBCBASSERT_H
32132bfccd21960e462352175f8553a5bdce8a210cnjn#define __PUB_TOOL_LIBCBASSERT_H
33132bfccd21960e462352175f8553a5bdce8a210cnjn
34535fb1b49a80f2e880f755ee618381de3e222ddfflorian#include "pub_tool_basics.h"   // VG_ macro
35535fb1b49a80f2e880f755ee618381de3e222ddfflorian
36132bfccd21960e462352175f8553a5bdce8a210cnjn#define tl_assert(expr)                                                 \
374ee9c560c7bbe7c305641964d5c2277e086ed1basewardj  ((void) (LIKELY(expr) ? 0 :                                           \
38bbd9a21ca8518fc34cd7b6254a61d72f82495120florian           (VG_(assert_fail) (/*isCore?*/False, #expr,                  \
39bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                              __FILE__, __LINE__,                       \
40bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                              __PRETTY_FUNCTION__,                      \
41bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                              ""),                                      \
42132bfccd21960e462352175f8553a5bdce8a210cnjn                              0)))
43132bfccd21960e462352175f8553a5bdce8a210cnjn
44132bfccd21960e462352175f8553a5bdce8a210cnjn#define tl_assert2(expr, format, args...)                               \
454ee9c560c7bbe7c305641964d5c2277e086ed1basewardj  ((void) (LIKELY(expr) ? 0 :                                           \
46bbd9a21ca8518fc34cd7b6254a61d72f82495120florian           (VG_(assert_fail) (/*isCore?*/False, #expr,                  \
47bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                              __FILE__, __LINE__,                       \
48bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                              __PRETTY_FUNCTION__,                      \
49132bfccd21960e462352175f8553a5bdce8a210cnjn                              format, ##args),                          \
50132bfccd21960e462352175f8553a5bdce8a210cnjn                              0)))
51132bfccd21960e462352175f8553a5bdce8a210cnjn
52132bfccd21960e462352175f8553a5bdce8a210cnjn__attribute__ ((__noreturn__))
53f39e9a36dca9642668a66c6b054f81c88650bcb9njnextern void VG_(exit)( Int status );
54f39e9a36dca9642668a66c6b054f81c88650bcb9njn
55f39e9a36dca9642668a66c6b054f81c88650bcb9njn/* Prints a panic message, appends newline and bug reporting info, aborts. */
56f39e9a36dca9642668a66c6b054f81c88650bcb9njn__attribute__ ((__noreturn__))
57bbd9a21ca8518fc34cd7b6254a61d72f82495120florianextern void  VG_(tool_panic) ( const HChar* str );
58f39e9a36dca9642668a66c6b054f81c88650bcb9njn
59f39e9a36dca9642668a66c6b054f81c88650bcb9njn__attribute__ ((__noreturn__))
60bbd9a21ca8518fc34cd7b6254a61d72f82495120florianextern void VG_(assert_fail) ( Bool isCore, const HChar* expr, const HChar* file,
61bbd9a21ca8518fc34cd7b6254a61d72f82495120florian                               Int line, const HChar* fn,
62132bfccd21960e462352175f8553a5bdce8a210cnjn                               const HChar* format, ... );
63132bfccd21960e462352175f8553a5bdce8a210cnjn
64132bfccd21960e462352175f8553a5bdce8a210cnjn#endif   // __PUB_TOOL_LIBCBASSERT_H
65132bfccd21960e462352175f8553a5bdce8a210cnjn
66132bfccd21960e462352175f8553a5bdce8a210cnjn/*--------------------------------------------------------------------*/
67132bfccd21960e462352175f8553a5bdce8a210cnjn/*--- end                                                          ---*/
68132bfccd21960e462352175f8553a5bdce8a210cnjn/*--------------------------------------------------------------------*/
69