FreeBSD/Linux Kernel Cross Reference
sys/kern/assert.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989,1988,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.7 93/05/10 17:47:39 rvb
30 * According to Friedl's wishes undo Change 2.6. Too many people
31 * seem to believe that Assert() can return a value.
32 * [93/05/10 15:47:06 rvb]
33 *
34 * Revision 2.6 92/05/21 17:12:41 jfriedl
35 * Made Assert() volatile under gcc.
36 * [92/05/16 jfriedl]
37 *
38 * Revision 2.5 91/05/14 16:39:41 mrt
39 * Correcting copyright
40 *
41 * Revision 2.4 91/02/05 17:25:28 mrt
42 * Changed to new Mach copyright
43 * [91/02/01 16:10:52 mrt]
44 *
45 * Revision 2.3 90/11/05 14:30:41 rpd
46 * Changed assert to use Assert instead of Debugger.
47 * [90/11/04 rpd]
48 *
49 * Revision 2.2 90/08/27 22:01:51 dbg
50 * Declare 'Debugger' to avoid more lint.
51 * [90/08/13 dbg]
52 *
53 * Revision 2.1 89/08/03 15:43:22 rwd
54 * Created.
55 *
56 * Revision 2.7 88/12/19 02:41:59 mwyoung
57 * It appears to be impossible to avoid lint for expressions
58 * of the form (constant1 < constant2). Make assert_static empty
59 * for lint.
60 * [88/12/17 mwyoung]
61 *
62 * Revision 2.6 88/10/18 03:37:27 mwyoung
63 * Use MACRO_BEGIN, MACRO_END.
64 * [88/10/11 mwyoung]
65 *
66 * Avoid lint warnings about constants in the "while" clause.
67 * [88/10/06 mwyoung]
68 *
69 * Revision 2.5 88/10/01 21:58:26 rpd
70 * Changed CS_ASSERT to CMUCS_ASSERT.
71 * [88/10/01 21:32:39 rpd]
72 *
73 * Revision 2.4 88/09/25 22:15:40 rpd
74 * Changed to use Debugger instead of panic.
75 * [88/09/12 23:04:20 rpd]
76 *
77 * Revision 2.3 88/08/24 02:22:40 mwyoung
78 * Adjusted include file references.
79 * [88/08/17 02:08:36 mwyoung]
80 *
81 * Revision 2.2 88/07/20 16:44:48 rpd
82 * Modify assert for kernel use.
83 *
84 */
85
86 #ifndef _KERN_ASSERT_H_
87 #define _KERN_ASSERT_H_
88
89 /* assert.h 4.2 85/01/21 */
90
91 #include <mach_assert.h>
92
93 #include <kern/macro_help.h>
94
95 #if MACH_ASSERT
96 extern void Assert();
97
98 #define assert(ex) \
99 MACRO_BEGIN \
100 if (!(ex)) \
101 Assert(__FILE__, __LINE__); \
102 MACRO_END
103
104 #ifdef lint
105 #define assert_static(x)
106 #else lint
107 #define assert_static(x) assert(x)
108 #endif lint
109
110 #else MACH_ASSERT
111 #define assert(ex)
112 #define assert_static(ex)
113 #endif MACH_ASSERT
114
115 #endif _KERN_ASSERT_H_
Cache object: 124879524ae8ff369d9196579c34d137
|