1 .\" $NetBSD: _DIAGASSERT.3,v 1.7 2007/01/22 11:57:44 jdc Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd expression verification macro
38 .Fn _DIAGASSERT expression
44 and if it is false, one or more of the following may occur:
45 .Bl -bullet -offset indent
47 a diagnostic message may be logged to the system logger with
49 This is default behaviour.
51 a diagnostic message may be printed to the
55 the calling process will be terminated by calling
59 This behaviour may be changed by setting the
61 environment variable (see below).
63 The diagnostic message consists of the text of the expression,
64 the name of the source file, the line number and the enclosing
76 macro is not compiled in by default, and will only be compiled in with the
81 This macro is used in the various system libraries such as the
83 to ensure that various library calls are invoked with valid arguments.
87 environment variable can be used to modify the default behaviour of
88 logging the assertion to the system logger.
91 may be set to one or more of the following characters:
92 .Bl -tag -width xxx -offset indent
95 once any assertion messages have been logged and/or printed.
100 Print the assertion message to the
107 Log the assertion message with
116 The diagnostic message has the following format:
117 .Bd -literal -offset indent
118 "assertion \e"%s\e" failed: file \e"%s\e", line %d, function \e"%s\e"\en",
119 "expression", __FILE__, __LINE__, __func__