Add a NOTE saying that invalid usage leads to undefined behaviour.

Inspired by PR 39684.
This commit is contained in:
apb 2008-10-07 13:03:50 +00:00
parent 7a91225cc4
commit 3fa869bc3a
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: queue.3,v 1.38 2008/05/02 18:11:05 martin Exp $
.\" $NetBSD: queue.3,v 1.39 2008/10/07 13:03:50 apb Exp $
.\"
.\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -53,7 +53,7 @@
.\"
.\" @(#)queue.3 8.1 (Berkeley) 12/13/93
.\"
.Dd December 11, 2007
.Dd October 7, 2008
.Dt QUEUE 3
.Os
.Sh NAME
@ -1171,6 +1171,12 @@ while (CIRCLEQ_FIRST(\*[Am]head) != (void *)\*[Am]head)
if (CIRCLEQ_EMPTY(\*[Am]head)) /* Test for emptiness. */
printf("nothing to do\\n");
.Ed
.Sh NOTES
Some of these macros or functions perform no error checking,
and invalid usage leads to undefined behaviour.
In the case of macros or functions that expect their arguments
to be elements that are present in the list or queue, passing an element
that is not present is invalid.
.Sh HISTORY
The
.Nm queue

View File

@ -1,4 +1,4 @@
.\" $NetBSD: tree.3,v 1.3 2004/04/14 11:05:19 pooka Exp $
.\" $NetBSD: tree.3,v 1.4 2008/10/07 13:03:50 apb Exp $
.\" $OpenBSD: tree.3,v 1.9 2003/05/20 09:13:38 jmc Exp $
.\"/*
.\" * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@ -29,7 +29,7 @@
.\" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" */
.Dd February 24, 2002
.Dd October 7, 2008
.Dt TREE 3
.Os
.Sh NAME
@ -416,6 +416,12 @@ The
.Fn RB_EMPTY
macro should be used to check whether a red-black tree is empty.
.Sh NOTES
Some of these macros or functions perform no error checking,
and invalid usage leads to undefined behaviour.
In the case of macros or functions that expect their arguments
to be elements that are present in the tree, passing an element
that is not present in the tree is invalid.
.Pp
Trying to free a tree in the following way is a common error:
.Bd -literal -offset indent
SPLAY_FOREACH(var, NAME, head) {