]>
Commit | Line | Data |
---|---|---|
fbd2eda1 GM |
1 | /* do not edit automatically generated by mc from Assertion. */ |
2 | /* Assertion.mod provides an assert procedure. | |
3 | ||
a945c346 | 4 | Copyright (C) 2001-2024 Free Software Foundation, Inc. |
fbd2eda1 GM |
5 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
6 | ||
7 | This file is part of GNU Modula-2. | |
8 | ||
9 | GNU Modula-2 is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU Modula-2 is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | General Public License for more details. | |
18 | ||
19 | Under Section 7 of GPL version 3, you are granted additional | |
20 | permissions described in the GCC Runtime Library Exception, version | |
21 | 3.1, as published by the Free Software Foundation. | |
22 | ||
23 | You should have received a copy of the GNU General Public License and | |
24 | a copy of the GCC Runtime Library Exception along with this program; | |
25 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
26 | <http://www.gnu.org/licenses/>. */ | |
27 | ||
28 | #include "config.h" | |
29 | #include "system.h" | |
431c0669 | 30 | #include <stdbool.h> |
fbd2eda1 GM |
31 | # if !defined (PROC_D) |
32 | # define PROC_D | |
33 | typedef void (*PROC_t) (void); | |
34 | typedef struct { PROC_t proc; } PROC; | |
35 | # endif | |
36 | ||
37 | #define _Assertion_H | |
38 | #define _Assertion_C | |
39 | ||
40 | # include "GStrIO.h" | |
41 | # include "GM2RTS.h" | |
42 | ||
43 | ||
44 | /* | |
45 | Assert - tests the boolean Condition, if it fails then HALT is called. | |
46 | */ | |
47 | ||
431c0669 | 48 | extern "C" void Assertion_Assert (bool Condition); |
fbd2eda1 GM |
49 | |
50 | ||
51 | /* | |
52 | Assert - tests the boolean Condition, if it fails then HALT is called. | |
53 | */ | |
54 | ||
431c0669 | 55 | extern "C" void Assertion_Assert (bool Condition) |
fbd2eda1 GM |
56 | { |
57 | if (! Condition) | |
58 | { | |
59 | StrIO_WriteString ((const char *) "assert failed - halting system", 30); | |
60 | StrIO_WriteLn (); | |
61 | M2RTS_HALT (-1); | |
62 | __builtin_unreachable (); | |
63 | } | |
64 | } | |
65 | ||
66 | extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) | |
67 | { | |
68 | } | |
69 | ||
70 | extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) | |
71 | { | |
72 | } |