USB device can now be unbind
[AROS.git] / compiler / stdc / __stdc_assert.c
blob40d48a1c768734b789ad2798d0f5541f91fbebb3
1 /*
2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 assert() stdc.library support
6 */
7 #include <proto/exec.h>
8 #include <proto/intuition.h>
9 #include <aros/arossupportbase.h>
10 #include <intuition/intuition.h>
11 #include <aros/debug.h>
13 #include <stdlib.h>
15 #include "__optionallibs.h"
17 /*****************************************************************************
19 NAME */
20 #include <assert.h>
22 void __stdc_assert (
24 /* SYNOPSIS */
25 const char * expr,
26 const char * file,
27 unsigned int line)
29 /* FUNCTION
30 This is a function that is used for implementation of the C99 assert()
31 function.
33 INPUTS
34 expr - The expression to evaluate. The type of the expression does
35 not matter, only if its zero/NULL or not.
36 file - Name of the source file.
37 line - Line number of assert() call.
39 RESULT
40 The function doesn't return.
42 NOTES
43 Different versions of this function are available. This function
44 is used when a program is using stdc.library but not
45 stdcio.library or posixc.library.
46 Because no normal DOS file I/O is available an attempt will be made
47 to display the assertion in a requester and thus deviating from the
48 C99 standard that says it to go to the error stream.
50 EXAMPLE
52 BUGS
54 SEE ALSO
55 assert()
57 INTERNALS
59 ******************************************************************************/
61 if (__intuition_available())
63 struct EasyStruct es =
65 sizeof(struct EasyStruct),
67 (CONST_STRPTR)"Failed Assertion",
68 (CONST_STRPTR)"Assertion (%s) failed in %s:%u",
69 (CONST_STRPTR)"OK"
71 EasyRequest(NULL, &es, NULL, expr, file, line);
73 else
74 kprintf("Assertion (%s) failed in %s:%u", expr, file, line);
76 abort();
79 AROS_MAKE_ASM_SYM(typeof(__assert), __assert, AROS_CSYM_FROM_ASM_NAME(__assert), AROS_CSYM_FROM_ASM_NAME(__stdc_assert));
80 AROS_EXPORT_ASM_SYM(AROS_CSYM_FROM_ASM_NAME(__assert));