]> gcc.gnu.org Git - gcc.git/blame - gcc/m2/mc-boot/GM2EXCEPTION.c
Remove unused parameter warning via introducing attribute unused.
[gcc.git] / gcc / m2 / mc-boot / GM2EXCEPTION.c
CommitLineData
7401123f
GM
1/* do not edit automatically generated by mc from M2EXCEPTION. */
2/* M2EXCEPTION.mod implement M2Exception and IsM2Exception.
3
4Copyright (C) 2001-2021 Free Software Foundation, Inc.
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"
30# if !defined (PROC_D)
31# define PROC_D
32 typedef void (*PROC_t) (void);
33 typedef struct { PROC_t proc; } PROC;
34# endif
35
36# include "Gmcrts.h"
37#define _M2EXCEPTION_H
38#define _M2EXCEPTION_C
39
40# include "GSYSTEM.h"
41# include "GRTExceptions.h"
42
43typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
44
51bc4b81
GM
45extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
46extern "C" unsigned int M2EXCEPTION_IsM2Exception (void);
7401123f 47
51bc4b81 48extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
7401123f
GM
49{
50 RTExceptions_EHBlock e;
51 unsigned int n;
52
53 /* If the program or coroutine is in the exception state then return the enumeration
54 value representing the exception cause. If it is not in the exception state then
55 raises and exception (exException). */
dce2ffd5
GM
56 e = RTExceptions_GetExceptionBlock ();
57 n = RTExceptions_GetNumber (e);
7401123f
GM
58 if (n == (UINT_MAX))
59 {
06c977f8 60 RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
7401123f
GM
61 }
62 else
63 {
64 return (M2EXCEPTION_M2Exceptions) (n);
65 }
06c977f8 66 ReturnException ("../../gcc-git-devel-modula2/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1);
7401123f
GM
67 __builtin_unreachable ();
68}
69
51bc4b81 70extern "C" unsigned int M2EXCEPTION_IsM2Exception (void)
7401123f
GM
71{
72 RTExceptions_EHBlock e;
73
74 /* Returns TRUE if the program or coroutine is in the exception state.
75 Returns FALSE if the program or coroutine is not in the exception state. */
dce2ffd5 76 e = RTExceptions_GetExceptionBlock ();
7401123f
GM
77 return (RTExceptions_GetNumber (e)) != (UINT_MAX);
78 /* static analysis guarentees a RETURN statement will be used before here. */
79 __builtin_unreachable ();
80}
81
206c4f77 82extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
7401123f
GM
83{
84 RTExceptions_SetExceptionBlock (RTExceptions_InitExceptionBlock ());
85}
86
206c4f77 87extern "C" void _M2_M2EXCEPTION_finish (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
7401123f
GM
88{
89}
This page took 0.089179 seconds and 5 git commands to generate.