OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [isoinfra/] [current/] [include/] [assert.h] - Blame information for rev 853

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

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_ISO_ASSERT_H
2
#define CYGONCE_ISO_ASSERT_H
3
/*========================================================================
4
//
5
//      assert.h
6
//
7
//      ISO C assertions
8
//
9
//========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
//========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     jlarmour
45
// Contributors:
46
// Date:          2000-04-14
47
// Purpose:       This file provides the assert functions required by
48
//                ISO C and POSIX 1003.1.
49
// Description:   The real contents of this file get set from the
50
//                configuration (set by the implementation)
51
// Usage:         #include <assert.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//======================================================================
56
*/
57
 
58
/* CONFIGURATION */
59
 
60
#include <pkgconf/isoinfra.h>          /* Configuration header */
61
#include <pkgconf/infra.h>             /* CYGDBG_USE_ASSERTS */
62
 
63
/* INCLUDES */
64
 
65
#ifdef CYGBLD_ISO_ASSERT_HEADER
66
# include CYGBLD_ISO_ASSERT_HEADER
67
#else
68
 
69
# ifdef NDEBUG
70
#  define assert( __bool ) ((void)0)
71
# else /* if NDEBUG is NOT defined */
72
 
73
/* First preference is to be standards compliant */
74
 
75
#if defined(CYGINT_ISO_STDIO_FORMATTED_IO) && CYGINT_ISO_EXIT
76
 
77
# include <stdio.h>
78
# include <stdlib.h>
79
 
80
# define assert( __bool )                                                 \
81
    do {                                                                  \
82
        if (0 == (__bool)) {                                              \
83
            fprintf( stderr, "User assertion failed: \"%s\", at %s:%d\n", \
84
                         #__bool, __FILE__, __LINE__);                    \
85
            abort();                                                      \
86
        }                                                                 \
87
    } while(0)
88
 
89
 
90
/* Second preference is to use the common infra assertion support */
91
 
92
#elif defined(CYGDBG_USE_ASSERTS)
93
 
94
# include <cyg/infra/cyg_ass.h>
95
 
96
# define assert( __bool ) \
97
        CYG_MACRO_START   \
98
        CYG_ASSERT( __bool, "User assertion failed: \""  #__bool "\"" ); \
99
        CYG_MACRO_END
100
#else /* Fallback */
101
 
102
# include <cyg/infra/diag.h>
103
 
104
# define assert( __bool )                                                 \
105
    do {                                                                  \
106
        if (0 == (__bool)) {                                              \
107
            diag_printf( "User assertion failed: \"%s\", at %s:%d\n",     \
108
                         #__bool, __FILE__, __LINE__);                    \
109
        for (;;);                                                         \
110
        }                                                                 \
111
    } while(0)
112
 
113
#endif
114
 
115
# endif /* NDEBUG not defined */
116
#endif
117
 
118
#endif /* CYGONCE_ISO_ASSERT_H multiple inclusion protection */
119
 
120
/* EOF assert.h */

powered by: WebSVN 2.1.0

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