OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [gdb_assert.h] - Blame information for rev 517

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
/* GDB-friendly replacement for <assert.h>.
2
   Copyright (C) 2000, 2001, 2007, 2008, 2009, 2010
3
   Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#ifndef GDB_ASSERT_H
21
#define GDB_ASSERT_H
22
 
23
/* PRAGMATICS: "gdb_assert.h":gdb_assert() is a lower case (rather
24
   than upper case) macro since that provides the closest fit to the
25
   existing lower case macro <assert.h>:assert() that it is
26
   replacing. */
27
 
28
#define gdb_assert(expr)                                                      \
29
  ((void) ((expr) ? 0 :                                                       \
30
           (gdb_assert_fail (#expr, __FILE__, __LINE__, ASSERT_FUNCTION), 0)))
31
 
32
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
33
   which contains the name of the function currently being defined.
34
   This is broken in G++ before version 2.6.
35
   C9x has a similar variable called __func__, but prefer the GCC one since
36
   it demangles C++ function names.  */
37
#if (GCC_VERSION >= 2004)
38
#define ASSERT_FUNCTION         __PRETTY_FUNCTION__
39
#else
40
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
41
#define ASSERT_FUNCTION         __func__
42
#endif
43
#endif
44
 
45
/* This prints an "Assertion failed" message, aksing the user if they
46
   want to continue, dump core, or just exit.  */
47
#if defined (ASSERT_FUNCTION)
48
#define gdb_assert_fail(assertion, file, line, function)                      \
49
  internal_error (file, line, _("%s: Assertion `%s' failed."),                   \
50
                  function, assertion)
51
#else
52
#define gdb_assert_fail(assertion, file, line, function)                      \
53
  internal_error (file, line, _("Assertion `%s' failed."),                       \
54
                  assertion)
55
#endif
56
 
57
#endif /* gdb_assert.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.