2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
5 C99 function assert() autodoc and stdcio.library support function
8 /*****************************************************************************
19 Evaluates the expression expr and if it's FALSE or NULL, then
20 printf a message and aborts the program. The message will
21 contain the expression, the name of the file with the assert
22 in it and the line in the file.
25 expr - The expression to evaluate. The type of the expression does
26 not matter, only if it's zero/NULL or not.
29 The function doesn't return.
32 Normally the output is sent to stderr and thus this code should
33 only be called from processes with the context of the process
35 In low level modules it is advised to use the ASSERT() macro for
37 As a last resort one can use the normal assert() macro but link
38 with the kernelassert static link library to get a version that
39 also outputs to kernel debug output.
40 With this assert also an Alert will be generated in place of abort of
44 // Make sure that x equals 1
53 ******************************************************************************/
59 /*****************************************************************************
64 void __stdcio_assert (
72 This is a function that is used for implementation of the C99 assert()
76 expr - The expression to evaluate. The type of the expression does
77 not matter, only if its zero/NULL or not.
78 file - Name of the source file.
79 line - Line number of assert() call.
82 The function doesn't return.
85 Different versions of this function are available. This function
86 is used when a program is using stdcio.library and not
98 ******************************************************************************/
100 fprintf (stderr
, "Assertion (%s) failed in %s:%u\n", expr
, file
, line
);
104 AROS_MAKE_ASM_SYM(typeof(__assert
), __assert
, AROS_CSYM_FROM_ASM_NAME(__assert
), AROS_CSYM_FROM_ASM_NAME(__stdcio_assert
));
105 AROS_EXPORT_ASM_SYM(AROS_CSYM_FROM_ASM_NAME(__assert
));