update copyright year range in GDB files
[deliverable/binutils-gdb.git] / sim / common / sim-assert.h
CommitLineData
c906108c
SS
1/* This file is part of the program GDB.
2
61baf725 3 Copyright (C) 1997-2017 Free Software Foundation, Inc.
c906108c
SS
4
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
4744ac1b 7 the Free Software Foundation; either version 3 of the License, or
c906108c
SS
8 (at your option) any later version.
9
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.
4744ac1b 14
c906108c 15 You should have received a copy of the GNU General Public License
4744ac1b 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
028f6515 17
c906108c
SS
18 */
19
20
618b526e
MF
21#ifndef SIM_ASSERT_H
22#define SIM_ASSERT_H
c906108c 23
c906108c
SS
24/* The subtle difference between SIM_ASSERT and ASSERT is that
25 SIM_ASSERT passes `sd' to sim_io_error for the SIM_DESC,
26 ASSERT passes NULL. */
27
28#if !defined (SIM_ASSERT)
29#if defined (WITH_ASSERT)
93129366 30#include "sim-io.h"
e7505490 31#include "libiberty.h"
c906108c
SS
32#define SIM_ASSERT(EXPRESSION) \
33do \
34 { \
35 if (WITH_ASSERT) \
36 { \
37 if (!(EXPRESSION)) \
38 { \
39 /* report the failure */ \
c906108c 40 sim_io_error (sd, "%s:%d: assertion failed - %s", \
e7505490 41 lbasename (__FILE__), __LINE__, #EXPRESSION); \
c906108c
SS
42 } \
43 } \
44 } \
45while (0)
46#else
47#define SIM_ASSERT(EXPRESSION) do { /*nothing*/; } while (0)
48#endif
49#endif
50
51#if !defined (ASSERT)
52#if defined (WITH_ASSERT)
93129366 53#include "sim-io.h"
e7505490 54#include "libiberty.h"
c906108c
SS
55#define ASSERT(EXPRESSION) \
56do \
57 { \
58 if (WITH_ASSERT) \
59 { \
60 if (!(EXPRESSION)) \
61 { \
62 /* report the failure */ \
c906108c 63 sim_io_error (NULL, "%s:%d: assertion failed - %s", \
e7505490 64 lbasename (__FILE__), __LINE__, #EXPRESSION); \
c906108c
SS
65 } \
66 } \
67 } \
68while (0)
69#else
70#define ASSERT(EXPRESSION) do { /*nothing*/; } while (0)
71#endif
72#endif
73
74#endif
This page took 0.765824 seconds and 4 git commands to generate.