aboutsummaryrefslogtreecommitdiff
path: root/libjava/include/default-signal.h
blob: 21d5d7a775e15e49e98f134e5c7563059f40480c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// default-signal.h - Catch runtime signals and turn them into exceptions.

/* Copyright (C) 1998, 1999  Cygnus Solutions

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

#ifndef JAVA_SIGNAL_H
#define JAVA_SIGNAL_H 1

#ifdef SJLJ_EXCEPTIONS

#define HANDLE_SEGV
#define HANDLE_FPE

#include <signal.h>

#define SIGNAL_HANDLER(_name)			\
static void _name (int _dummy)

#define INIT_SEGV						\
do								\
  {								\
    nullp = new java::lang::NullPointerException ();		\
    signal (SIGSEGV, catch_segv);				\
  }								\
while (0)							
								
#define INIT_FPE						\
do								\
  {								\
    arithexception = new java::lang::ArithmeticException 	\
      (JvNewStringLatin1 ("/ by zero"));			\
    signal (SIGFPE, catch_fpe);					\
  }								\
while (0)

#define MAKE_THROW_FRAME  do {} while (0)

#else /* SJLJ_EXCEPTIONS */

#undef HANDLE_SEGV
#undef HANDLE_FPE

#define INIT_SEGV   do {} while (0)
#define INIT_FPE   do {} while (0)

#endif /* SJLJ_EXCEPTIONS */

#endif /* JAVA_SIGNAL_H */