]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/pge-boot/GAssertion.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / pge-boot / GAssertion.cc
1 /* do not edit automatically generated by mc from Assertion. */
2 /* Assertion.mod provides an assert procedure.
3
4 Copyright (C) 2001-2024 Free Software Foundation, Inc.
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 <stdbool.h>
29 # if !defined (PROC_D)
30 # define PROC_D
31 typedef void (*PROC_t) (void);
32 typedef struct { PROC_t proc; } PROC;
33 # endif
34
35 #define _Assertion_H
36 #define _Assertion_C
37
38 # include "GStrIO.h"
39 # include "GM2RTS.h"
40
41
42 /*
43 Assert - tests the boolean Condition, if it fails then HALT is called.
44 */
45
46 extern "C" void Assertion_Assert (bool Condition);
47
48
49 /*
50 Assert - tests the boolean Condition, if it fails then HALT is called.
51 */
52
53 extern "C" void Assertion_Assert (bool Condition)
54 {
55 if (! Condition)
56 {
57 StrIO_WriteString ((const char *) "assert failed - halting system", 30);
58 StrIO_WriteLn ();
59 M2RTS_HALT (-1);
60 __builtin_unreachable ();
61 }
62 }
63
64 extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
65 {
66 }
67
68 extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
69 {
70 }