Use a packed structure instead of byte array fields, to respect strict aliasing rules and make code more readable
Trampoline disassembling has been long moved to the library, no need to have it in the public header

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@1166 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-libraries/pseh/include/pseh/pseh2.h b/mingw-w64-libraries/pseh/include/pseh/pseh2.h
index 07d3d3e..a6f97ed 100644
--- a/mingw-w64-libraries/pseh/include/pseh/pseh2.h
+++ b/mingw-w64-libraries/pseh/include/pseh/pseh2.h
@@ -87,43 +87,6 @@
 }

 #endif

 

-#if defined(__i386__)

-typedef struct __SEHTrampoline

-{

-	unsigned char STR_MovEcx;

-	unsigned char STR_Closure[4];

-	unsigned char STR_Jmp;

-	unsigned char STR_Function[4];

-}

-_SEHTrampoline_t;

-

-static

-__inline__

-__attribute__((always_inline))

-int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)

-{

-	return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;

-}

-

-static

-__inline__

-__attribute__((always_inline))

-void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)

-{

-	return (void *)(*(int *)(&trampoline_->STR_Function[0]) + (int)(trampoline_ + 1));

-}

-

-static

-__inline__

-__attribute__((always_inline))

-void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)

-{

-	return (void *)*(int *)(&trampoline_->STR_Closure[0]);

-}

-#else

-#error TODO

-#endif

-

 /* A no-op side effect that scares GCC */

 #define __SEH_SIDE_EFFECT __asm__ __volatile__("#")

 

@@ -428,9 +391,9 @@
 #define _SEH2_EXCEPT(...) } if (0) {

 #define _SEH2_END }

 

-#define _SEH2_GetExceptionInformation() 

+#define _SEH2_GetExceptionInformation()

 #define _SEH2_GetExceptionCode() STATUS_SUCCESS

-#define _SEH2_AbnormalTermination() 

+#define _SEH2_AbnormalTermination()

 

 #define _SEH2_YIELD(STMT_) STMT_

 #define _SEH2_LEAVE

diff --git a/mingw-w64-libraries/pseh/src/i386/framebased-gcchack.c b/mingw-w64-libraries/pseh/src/i386/framebased-gcchack.c
index b0d8ca5..1dc0634 100644
--- a/mingw-w64-libraries/pseh/src/i386/framebased-gcchack.c
+++ b/mingw-w64-libraries/pseh/src/i386/framebased-gcchack.c
@@ -42,6 +42,34 @@
 extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);

 extern int __cdecl __SEH2UnwindHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);

 

+typedef struct __SEHTrampoline

+{

+	unsigned char STR_MovEcx;

+	unsigned char * STR_Closure;

+	unsigned char STR_Jmp;

+	unsigned char * STR_Function;

+}

+__attribute__((packed))

+_SEHTrampoline_t;

+

+FORCEINLINE

+int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)

+{

+	return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;

+}

+

+FORCEINLINE

+void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)

+{

+	return (int)(trampoline_ + 1) + trampoline_->STR_Function;

+}

+

+FORCEINLINE

+void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)

+{

+	return trampoline_->STR_Closure;

+}

+

 FORCEINLINE

 _SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void)

 {