]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/mc-boot/GAssertion.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc-boot / GAssertion.cc
CommitLineData
fbd2eda1
GM
1/* do not edit automatically generated by mc from Assertion. */
2/* Assertion.mod provides an assert procedure.
3
a945c346 4Copyright (C) 2001-2024 Free Software Foundation, Inc.
fbd2eda1
GM
5Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6
7This file is part of GNU Modula-2.
8
9GNU Modula-2 is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 3, or (at your option)
12any later version.
13
14GNU Modula-2 is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17General Public License for more details.
18
19Under Section 7 of GPL version 3, you are granted additional
20permissions described in the GCC Runtime Library Exception, version
213.1, as published by the Free Software Foundation.
22
23You should have received a copy of the GNU General Public License and
24a copy of the GCC Runtime Library Exception along with this program;
25see 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 48extern "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 55extern "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
66extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
67{
68}
69
70extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
71{
72}