Error out when assigning void value.
[tinycc/miki.git] / win32 / include / excpt.h
blob26cc9437c0b4c79d991f3fbe8e5f904123e611fe
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _INC_EXCPT
7 #define _INC_EXCPT
9 #include <_mingw.h>
11 #pragma pack(push,_CRT_PACKING)
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 struct _EXCEPTION_POINTERS;
19 #ifndef EXCEPTION_DISPOSITION
20 #define EXCEPTION_DISPOSITION int
21 #endif
22 #define ExceptionContinueExecution 0
23 #define ExceptionContinueSearch 1
24 #define ExceptionNestedException 2
25 #define ExceptionCollidedUnwind 3
27 #if (defined(_X86_) && !defined(__x86_64))
28 struct _EXCEPTION_RECORD;
29 struct _CONTEXT;
31 EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext);
32 #elif defined(__ia64__)
34 typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
35 struct _EXCEPTION_RECORD;
36 struct _CONTEXT;
37 struct _DISPATCHER_CONTEXT;
39 _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer);
40 #elif defined(__x86_64)
42 struct _EXCEPTION_RECORD;
43 struct _CONTEXT;
44 #endif
46 #define GetExceptionCode _exception_code
47 #define exception_code _exception_code
48 #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
49 #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
50 #define AbnormalTermination _abnormal_termination
51 #define abnormal_termination _abnormal_termination
53 unsigned long __cdecl _exception_code(void);
54 void *__cdecl _exception_info(void);
55 int __cdecl _abnormal_termination(void);
57 #define EXCEPTION_EXECUTE_HANDLER 1
58 #define EXCEPTION_CONTINUE_SEARCH 0
59 #define EXCEPTION_CONTINUE_EXECUTION -1
61 /* CRT stuff */
62 typedef void (__cdecl * _PHNDLR)(int);
64 struct _XCPT_ACTION {
65 unsigned long XcptNum;
66 int SigNum;
67 _PHNDLR XcptAction;
70 extern struct _XCPT_ACTION _XcptActTab[];
71 extern int _XcptActTabCount;
72 extern int _XcptActTabSize;
73 extern int _First_FPE_Indx;
74 extern int _Num_FPE;
76 int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr);
77 int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr);
80 * The type of function that is expected as an exception handler to be
81 * installed with _try1.
83 typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
85 #ifndef HAVE_NO_SEH
87 * This is not entirely necessary, but it is the structure installed by
88 * the _try1 primitive below.
90 typedef struct _EXCEPTION_REGISTRATION {
91 struct _EXCEPTION_REGISTRATION *prev;
92 EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
93 } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
95 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
96 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
97 #endif
99 #if (defined(_X86_) && !defined(__x86_64))
100 #define __try1(pHandler) \
101 __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
103 #define __except1 \
104 __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
105 : : : "%eax");
106 #elif defined(__x86_64)
107 #define __try1(pHandler) \
108 __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler));
110 #define __except1 \
111 __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \
112 : : : "%rax");
113 #else
114 #define __try1(pHandler)
115 #define __except1
116 #endif
118 #ifdef __cplusplus
120 #endif
122 #pragma pack(pop)
123 #endif