1 /* This file is part of the program GDB.
3 Copyright (C) 1997, Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef _SIM_ASSERT_H_
23 #define _SIM_ASSERT_H_
25 #define SIM_FILTER_PATH(FILE, PATH) \
28 /* strip leading path */ \
29 const char *p = (PATH); \
31 while (*p != '\0' && *p != ':') \
40 /* The subtle difference between SIM_ASSERT and ASSERT is that
41 SIM_ASSERT passes `sd' to sim_io_error for the SIM_DESC,
42 ASSERT passes NULL. */
44 #if !defined (SIM_ASSERT)
45 #if defined (WITH_ASSERT)
46 #define SIM_ASSERT(EXPRESSION) \
53 /* report the failure */ \
55 SIM_FILTER_PATH(file, __FILE__); \
56 sim_io_error (sd, "%s:%d: assertion failed - %s", \
57 file, __LINE__, #EXPRESSION); \
63 #define SIM_ASSERT(EXPRESSION) do { /*nothing*/; } while (0)
68 #if defined (WITH_ASSERT)
69 #define ASSERT(EXPRESSION) \
76 /* report the failure */ \
78 SIM_FILTER_PATH(file, __FILE__); \
79 sim_io_error (NULL, "%s:%d: assertion failed - %s", \
80 file, __LINE__, #EXPRESSION); \
86 #define ASSERT(EXPRESSION) do { /*nothing*/; } while (0)