set big endian as default for armeb aros target. (mschulz)
[AROS.git] / compiler / stdc / __stdc_assert.c
blob499fb6c6dee62641d14f440687568d5baa2f1934
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>
9 #define __NOBLIBBASE__
11 #include <aros/arossupportbase.h>
12 #include <intuition/intuition.h>
13 #include <aros/debug.h>
15 #include <stdlib.h>
17 #include "__stdc_intbase.h"
18 #include "__optionallibs.h"
20 /*****************************************************************************
22 NAME */
23 #include <assert.h>
25 void __stdc_assert (
27 /* SYNOPSIS */
28 const char * expr,
29 const char * file,
30 unsigned int line)
32 /* FUNCTION
33 This is a function that is used for implementation of the C99 assert()
34 function.
36 INPUTS
37 expr - The expression to evaluate. The type of the expression does
38 not matter, only if its zero/NULL or not.
39 file - Name of the source file.
40 line - Line number of assert() call.
42 RESULT
43 The function doesn't return.
45 NOTES
46 Different versions of this function are available. This function
47 is used when a program is using stdc.library but not
48 stdcio.library or posixc.library.
49 Because no normal DOS file I/O is available an attempt will be made
50 to display the assertion in a requester and thus deviating from the
51 C99 standard that says it to go to the error stream.
53 EXAMPLE
55 BUGS
57 SEE ALSO
58 assert()
60 INTERNALS
62 ******************************************************************************/
64 struct StdCIntBase *StdCBase =
65 (struct StdCIntBase *)__aros_getbase_StdCBase();
67 if (__intuition_available(StdCBase))
69 struct EasyStruct es =
71 sizeof(struct EasyStruct),
73 (CONST_STRPTR)"Failed Assertion",
74 (CONST_STRPTR)"Assertion (%s) failed in %s:%u",
75 (CONST_STRPTR)"OK"
78 stdcEasyRequest(StdCBase->StdCIntuitionBase, NULL, &es, NULL, expr, file, line);
80 else
81 kprintf("Assertion (%s) failed in %s:%u", expr, file, line);
83 abort();
86 AROS_MAKE_ASM_SYM(typeof(__assert), __assert, AROS_CSYM_FROM_ASM_NAME(__assert), AROS_CSYM_FROM_ASM_NAME(__stdc_assert));
87 AROS_EXPORT_ASM_SYM(AROS_CSYM_FROM_ASM_NAME(__assert));