1 /*
2 Copyright (c) 1990 Regents of the University of California.
3 All rights reserved.
4  */
5 /*
6 FUNCTION
7 <<assert>>---macro for debugging diagnostics
8 
9 INDEX
10 	assert
11 
12 SYNOPSIS
13 	#include <assert.h>
14 	void assert(int <[expression]>);
15 
16 DESCRIPTION
17 	Use this macro to embed debuggging diagnostic statements in
18 	your programs.  The argument <[expression]> should be an
19 	expression which evaluates to true (nonzero) when your program
20 	is working as you intended.
21 
22 	When <[expression]> evaluates to false (zero), <<assert>>
23 	calls <<abort>>, after first printing a message showing what
24 	failed and where:
25 
26 . Assertion failed: <[expression]>, file <[filename]>, line <[lineno]>, function: <[func]>
27 
28 	If the name of the current function is not known (for example,
29 	when using a C89 compiler that does not understand __func__),
30 	the function location is omitted.
31 
32 	The macro is defined to permit you to turn off all uses of
33 	<<assert>> at compile time by defining <<NDEBUG>> as a
34 	preprocessor variable.   If you do this, the <<assert>> macro
35 	expands to
36 
37 . (void(0))
38 
39 RETURNS
40 	<<assert>> does not return a value.
41 
42 PORTABILITY
43 	The <<assert>> macro is required by ANSI, as is the behavior
44 	when <<NDEBUG>> is defined.
45 
46 Supporting OS subroutines required (only if enabled): <<close>>, <<fstat>>,
47 <<getpid>>, <<isatty>>, <<kill>>, <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
48 */
49 
50 #include <assert.h>
51 #include <stdlib.h>
52 #include <stdio.h>
53 
54 void
__assert_no_args(void)55 __assert_no_args  (void)
56 {
57     fprintf(stderr, "assertion failed\n");
58     abort();
59 }
60