FreeBSD/Linux Kernel Cross Reference
sys/kern/assert.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993-1987 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: assert.h,v $
29 * Revision 2.8 93/11/17 17:05:47 dbg
30 * This is the appropriate header to declare 'Debugger' and 'panic'.
31 * [93/09/30 dbg]
32 *
33 * ANSI-fied.
34 * [93/06/16 dbg]
35 *
36 * Revision 2.7 93/05/10 17:47:39 rvb
37 * According to Friedl's wishes undo Change 2.6. Too many people
38 * seem to believe that Assert() can return a value.
39 * [93/05/10 15:47:06 rvb]
40 *
41 * Revision 2.6 92/05/21 17:12:41 jfriedl
42 * Made Assert() volatile under gcc.
43 * [92/05/16 jfriedl]
44 *
45 * Revision 2.5 91/05/14 16:39:41 mrt
46 * Correcting copyright
47 *
48 * Revision 2.4 91/02/05 17:25:28 mrt
49 * Changed to new Mach copyright
50 * [91/02/01 16:10:52 mrt]
51 *
52 * Revision 2.3 90/11/05 14:30:41 rpd
53 * Changed assert to use Assert instead of Debugger.
54 * [90/11/04 rpd]
55 *
56 * Revision 2.2 90/08/27 22:01:51 dbg
57 * Declare 'Debugger' to avoid more lint.
58 * [90/08/13 dbg]
59 *
60 * Revision 2.1 89/08/03 15:43:22 rwd
61 * Created.
62 *
63 * Revision 2.7 88/12/19 02:41:59 mwyoung
64 * It appears to be impossible to avoid lint for expressions
65 * of the form (constant1 < constant2). Make assert_static empty
66 * for lint.
67 * [88/12/17 mwyoung]
68 *
69 * Revision 2.6 88/10/18 03:37:27 mwyoung
70 * Use MACRO_BEGIN, MACRO_END.
71 * [88/10/11 mwyoung]
72 *
73 * Avoid lint warnings about constants in the "while" clause.
74 * [88/10/06 mwyoung]
75 *
76 * Revision 2.5 88/10/01 21:58:26 rpd
77 * Changed CS_ASSERT to CMUCS_ASSERT.
78 * [88/10/01 21:32:39 rpd]
79 *
80 * Revision 2.4 88/09/25 22:15:40 rpd
81 * Changed to use Debugger instead of panic.
82 * [88/09/12 23:04:20 rpd]
83 *
84 * Revision 2.3 88/08/24 02:22:40 mwyoung
85 * Adjusted include file references.
86 * [88/08/17 02:08:36 mwyoung]
87 *
88 * Revision 2.2 88/07/20 16:44:48 rpd
89 * Modify assert for kernel use.
90 *
91 */
92
93 #ifndef _KERN_ASSERT_H_
94 #define _KERN_ASSERT_H_
95
96 /* assert.h 4.2 85/01/21 */
97
98 #include <mach_assert.h>
99
100 #include <kern/macro_help.h>
101 #include <sys/stdarg.h>
102
103 #if MACH_ASSERT
104 extern void Assert(const char *, const int);
105
106 #define assert(ex) \
107 MACRO_BEGIN \
108 if (!(ex)) \
109 Assert(__FILE__, __LINE__); \
110 MACRO_END
111
112 #ifdef lint
113 #define assert_static(x)
114 #else /* lint */
115 #define assert_static(x) assert(x)
116 #endif /* lint */
117
118 #else /* MACH_ASSERT */
119 #define assert(ex)
120 #define assert_static(ex)
121 #endif /* MACH_ASSERT */
122
123 /*
124 * Be extremely non-assertive.
125 * (Passive-aggressive is more like it...)
126 */
127 extern void
128 panic(const char *s, ...); /* may return if stepped through */
129
130 /*
131 * Invoke debugger
132 */
133 extern void
134 Debugger(const char *);
135
136 /*
137 * Initialize
138 */
139 extern void
140 panic_init(void);
141
142 #endif /* _KERN_ASSERT_H_ */
Cache object: 6abb2734c18503556d5e799ec00c4877
|