diff options
author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2014-08-10 15:21:26 +0000 |
---|---|---|
committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2014-08-10 15:21:26 +0000 |
commit | 08d41c70c103461c16a7b34f4915621899316959 (patch) | |
tree | 7775cf7d2bf574d93bcf732d53e3c24c208ab300 /lib/libc/isc | |
parent | e3c3754c0615e648913cc48e9001945eebda767d (diff) | |
download | src-08d41c70c103461c16a7b34f4915621899316959.tar.gz src-08d41c70c103461c16a7b34f4915621899316959.zip |
We don't use these files.
Notes
Notes:
svn path=/vendor/resolver/dist/; revision=269781
Diffstat (limited to 'lib/libc/isc')
-rw-r--r-- | lib/libc/isc/assertions.c | 94 | ||||
-rw-r--r-- | lib/libc/isc/assertions.mdoc | 138 |
2 files changed, 0 insertions, 232 deletions
diff --git a/lib/libc/isc/assertions.c b/lib/libc/isc/assertions.c deleted file mode 100644 index b71e5a32d334..000000000000 --- a/lib/libc/isc/assertions.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1997, 1999, 2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: assertions.c,v 1.5 2008/11/14 02:36:51 marka Exp $"; -#endif - -#include "port_before.h" - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <isc/assertions.h> - -#include "port_after.h" - -/* - * Forward. - */ - -static void default_assertion_failed(const char *, int, assertion_type, - const char *, int); - -/* - * Public. - */ - -assertion_failure_callback __assertion_failed = default_assertion_failed; - -void -set_assertion_failure_callback(assertion_failure_callback f) { - if (f == NULL) - __assertion_failed = default_assertion_failed; - else - __assertion_failed = f; -} - -const char * -assertion_type_to_text(assertion_type type) { - const char *result; - - switch (type) { - case assert_require: - result = "REQUIRE"; - break; - case assert_ensure: - result = "ENSURE"; - break; - case assert_insist: - result = "INSIST"; - break; - case assert_invariant: - result = "INVARIANT"; - break; - default: - result = NULL; - } - return (result); -} - -/* - * Private. - */ - -/* coverity[+kill] */ -static void -default_assertion_failed(const char *file, int line, assertion_type type, - const char *cond, int print_errno) -{ - fprintf(stderr, "%s:%d: %s(%s)%s%s failed.\n", - file, line, assertion_type_to_text(type), cond, - (print_errno) ? ": " : "", - (print_errno) ? strerror(errno) : ""); - abort(); - /* NOTREACHED */ -} - -/*! \file */ diff --git a/lib/libc/isc/assertions.mdoc b/lib/libc/isc/assertions.mdoc deleted file mode 100644 index 4b77e569e312..000000000000 --- a/lib/libc/isc/assertions.mdoc +++ /dev/null @@ -1,138 +0,0 @@ -.\" $Id: assertions.mdoc,v 1.3 2004/03/09 06:30:06 marka Exp $ -.\" -.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") -.\" Copyright (c) 1997,1999 by Internet Software Consortium. -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd November 17, 1997 -.Dt ASSERTIONS 3 -.Os ISC -.Sh NAME -.Nm REQUIRE , -.Nm REQUIRE_ERR , -.Nm ENSURE , -.Nm ENSURE_ERR , -.Nm INSIST , -.Nm INSIST_ERR , -.Nm INVARIANT , -.Nm INVARIANT_ERR , -.Nm set_assertion_failure_callback -.Nd assertion system -.Sh SYNOPSIS -.Fd #include <isc/assertions.h> -.Fo "typedef void (*assertion_failure_callback)" -.Fa "char *filename" -.Fa "int line" -.Fa "assertion_type type" -.Fa "char *condition" -.Fa "int print_errno" -.Fc -.Fn REQUIRE "int boolean_expression" -.Fn REQUIRE_ERR "int boolean_expression" -.Fn ENSURE "int boolean_expression" -.Fn ENSURE_ERR "int boolean_expression" -.Fn INSIST "int boolean_expression" -.Fn INSIST_ERR "int boolean_expression" -.Fn INVARIANT "int boolean_expression" -.Fn INVARIANT_ERR "int boolean_expression" -.Ft void -.Fn set_assertion_failure_callback "assertion_failure_callback callback" -.Ft char * -.Fn assertion_type_to_text "assertion_type type" -.Sh DESCRIPTION -The -.Fn REQUIRE , -.Fn ENSURE , -.Fn INSIST , -and -.Fn INVARIANT -macros evaluate a boolean expression, and if it is false, they invoke the -current assertion failure callback. The default callback will print a message -to -.Li stderr -describing the failure, and then cause the program to dump core. -If the -.Dq Fn _ERR -variant of the assertion is used, the callback will include -.Fn strerror "errno" -in its message. -.Pp -Each assertion type has an associated -.Li CHECK -macro. If this macro's value is -.Dq 0 -when -.Dq "<isc/assertions.h>" -is included, then assertions of that type will not be checked. E.g. -.Pp -.Dl #define CHECK_ENSURE 0 -.Pp -will disable checking of -.Fn ENSURE -and -.Fn ENSURE_ERR . -The macros -.Li CHECK_ALL -and -.Li CHECK_NONE -may also be used, respectively specifying that either all or none of the -assertion types should be checked. -.Pp -.Fn set_assertion_failure_callback -specifies the function to call when an assertion fails. -.Pp -When an -.Fn assertion_failure_callback -is called, the -.Fa filename -and -.Fa line -arguments specify the filename and line number of the failing assertion. -The -.Fa type -is one of: -.Bd -literal -offset indent -assert_require -assert_ensure -assert_insist -assert_invariant -.Ed -.Pp -and may be used by the callback to determine the type of the failing -assertion. -.Fa condition -is the literal text of the assertion that failed. -.Fa print_errno -will be non-zero if the callback should print -.Fa strerror "errno" -as part of its output. -.Pp -.Fn assertion_type_to_text -returns a textual representation of -.Fa type . -For example, -.Fn assertion_type_to_text "assert_require" -returns the string -.Dq REQUIRE . -.Sh SEE ALSO -.Rs -.%A Bertrand Meyer -.%B Object-Oriented Software Construction, 2nd edition -.%Q Prentice\-Hall -.%D 1997 -.%O ISBN 0\-13\-629155\-4 -.%P chapter 11 -.Re -.Sh AUTHOR -Bob Halley (ISC). |