|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * HISTORY
27: * 15-Feb-90 Gregg Kellogg (gk) at NeXT
28: * Updated to machine independent based on mach sources.
29: *
30: * 21-Nov-88 Avadis Tevanian (avie) at NeXT.
31: * Created based on machine dependent version.
32: */
33:
34: #ifndef _KERN_ASSERT_H_
35: #define _KERN_ASSERT_H_
36:
37: #if _KERNEL
38: #ifdef KERNEL_BUILD
39: #import <mach_assert.h>
40: #else /* KERNEL_BUILD */
41: #ifndef MACH_ASSERT
42: #define MACH_ASSERT DEBUG
43: #endif /* MACH_ASSERT */
44: #endif /* KERNEL_BUILD */
45:
46: #if MACH_ASSERT
47: #import <kernserv/printf.h>
48:
49: #ifdef __GNUC__
50: #define ASSERT(e) \
51: if ((e) == 0) { \
52: printf ("ASSERTION " #e " failed at line %d in %s\n", \
53: __LINE__, __FILE__); \
54: panic ("assertion failed"); \
55: }
56: #else /* !__GNUC__ */
57: #define ASSERT(e) \
58: if ((e) == 0) { \
59: printf ("ASSERTION e failed at line %d in %s\n", \
60: __LINE__, __FILE__); \
61: panic ("assertion failed"); \
62: }
63: #endif /* !__GNUC__ */
64: #else /* MACH_ASSERT */
65: #define ASSERT(e)
66: #endif /* MACH_ASSERT */
67:
68: /*
69: * For compatibility with the code they are writing at CMU.
70: */
71: #define assert(e) ASSERT(e)
72: #ifdef lint
73: #define assert_static(x)
74: #else /* lint */
75: #define assert_static(x) assert(x)
76: #endif /* lint */
77:
78: #endif /* _KERNEL */
79: #endif /* _KERN_ASSERT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.