65 lines
1.8 KiB
Plaintext
65 lines
1.8 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/ASSERT @(#)ASSERT 43.12 of 3/25/93
|
|
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
|
|
.TH ASSERT D3
|
|
.SH NAME
|
|
\f4ASSERT\f1 \- verify assertion
|
|
.IX "\f4ASSERT\fP(D3)"
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/debug.h>
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
void ASSERT(int \f2expression\fP);
|
|
.ft 1
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2expression\f1" 10n
|
|
Expression to be evaluated.
|
|
.RE
|
|
.SH DESCRIPTION
|
|
\f4ASSERT\f1 is a debugging interface for verifying program invariants
|
|
within code that is compiled with the \f4DEBUG\f1 compilation option
|
|
defined.
|
|
.SS "Return Values"
|
|
If \f2expression\f1 evaluates to non-zero, \f4ASSERT\f1 returns no value.
|
|
If \f2expression\f1 evaluates to zero, \f4ASSERT\f1 panics the system.
|
|
.SH USAGE
|
|
\f2expression\f1 is a boolean expression that the caller expects to
|
|
evaluate to non-zero (that is, the caller is asserting that the expression
|
|
has a non-zero value).
|
|
If \f2expression\f1 evaluates to non-zero, the \f4ASSERT\f1
|
|
call has no effect.
|
|
If \f2expression\f1 evaluates to zero, \f4ASSERT\f1 causes the system
|
|
to panic with the following message:
|
|
.sp 0.4
|
|
.nf
|
|
.ft 4
|
|
PANIC: assertion failed: \f2expression\fP, file: \f2filename\fP, line: \f2lineno\fP
|
|
.ft 1
|
|
.fi
|
|
.P
|
|
where \f2filename\f1 is the name of the source file in which the failed
|
|
assertion appears and \f2lineno\f1 is the line number of the \f4ASSERT\f1
|
|
call within the file.
|
|
.P
|
|
When the \f4DEBUG\f1 compilation option is not defined,
|
|
\f4ASSERT\f1 calls are not compiled into the code, and therefore have
|
|
no effect, including the fact that \f2expression\fP is not
|
|
evaluated.
|
|
.SS Level
|
|
Initialization, Base or Interrupt.
|
|
.SS "Synchronization Constraints"
|
|
Does not sleep.
|
|
.P
|
|
.P
|
|
Driver-defined basic locks, read/write locks, and sleep locks
|
|
may be held across calls to this function.
|
|
.SH REFERENCES
|
|
.na
|
|
\f4cmn_err\fP(D3)
|
|
.ad
|