/usr/i686-w64-mingw32/include/pseh/framebased.h is in mingw-w64-i686-dev 3.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | /*
Copyright (c) 2004/2005 KJK::Hyperion
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef KJK_PSEH_FRAMEBASED_H_
#define KJK_PSEH_FRAMEBASED_H_
#if ((__GNUC__ > 4) && (__GNUC_MINOR__ > 1))
/* warning: this will hide uninitialized variable warnings in the following code */
# pragma GCC diagnostic ignored "-Wuninitialized"
#endif
#include <pseh/framebased/internal.h>
#include <pseh/excpt.h>
#ifndef offsetof
# include <stddef.h>
#endif
#if defined(_SEH_NO_NATIVE_NLG)
# error PSEH setjmp/longjmp fallback is no longer supported
#endif
#if defined(__GNUC__)
# define _SEHLongJmp __builtin_longjmp
# define _SEHSetJmp __builtin_setjmp
typedef void * _SEHJmpBuf_t[5];
#else
# include <setjmp.h>
# define _SEHLongJmp longjmp
# define _SEHSetJmp setjmp
# define _SEHJmpBuf_t jmp_buf
#endif
#ifdef __cplusplus
# define _SEH_INIT_CONST static const
#else
# define _SEH_INIT_CONST register const
#endif
typedef struct __SEHFrame
{
_SEHPortableFrame_t SEH_Header;
void * volatile SEH_Locals;
}
_SEHFrame_t;
typedef struct __SEHTryLevel
{
_SEHPortableTryLevel_t ST_Header;
_SEHJmpBuf_t ST_JmpBuf;
}
_SEHTryLevel_t;
static __declspec(noreturn) __inline void __stdcall _SEHCompilerSpecificHandler
(
_SEHPortableTryLevel_t * trylevel
)
{
_SEHTryLevel_t * mytrylevel;
mytrylevel = _SEH_CONTAINING_RECORD(trylevel, _SEHTryLevel_t, ST_Header);
_SEHLongJmp(mytrylevel->ST_JmpBuf, 1);
}
static const int _SEHScopeKind = 1;
static _SEHPortableFrame_t * const _SEHPortableFrame = 0;
static _SEHPortableTryLevel_t * const _SEHPortableTryLevel = 0;
/* SHARED LOCALS */
/* Access the locals for the current frame */
#define _SEH_ACCESS_LOCALS(LOCALS_) \
_SEH_LOCALS_TYPENAME(LOCALS_) * _SEHPLocals; \
_SEHPLocals = \
_SEH_PVOID_CAST \
( \
_SEH_LOCALS_TYPENAME(LOCALS_) *, \
_SEH_CONTAINING_RECORD(_SEHPortableFrame, _SEHFrame_t, SEH_Header) \
->SEH_Locals \
);
/* Access local variable VAR_ */
#define _SEH_VAR(VAR_) _SEHPLocals->VAR_
/* FILTER FUNCTIONS */
/* Declares a filter function's prototype */
#define _SEH_FILTER(NAME_) \
long __stdcall NAME_ \
( \
struct _EXCEPTION_POINTERS * _SEHExceptionPointers, \
struct __SEHPortableFrame * _SEHPortableFrame \
)
/* Declares a static filter */
#define __SEH_STATIC_FILTER(ACTION_) ((ACTION_) + 2)
#define _SEH_STATIC_FILTER(ACTION_) ((_SEHFilter_t)(__SEH_STATIC_FILTER(ACTION_)))
/* Declares a PSEH filter wrapping a regular filter function */
#define _SEH_WRAP_FILTER(WRAPPER_, NAME_) \
static __inline _SEH_FILTER(WRAPPER_) \
{ \
return (NAME_)(_SEHExceptionPointers); \
}
/* FINALLY FUNCTIONS */
/* Declares a finally function's prototype */
#define _SEH_FINALLYFUNC(NAME_) \
void __stdcall NAME_ \
( \
struct __SEHPortableFrame * _SEHPortableFrame \
)
/* Declares a PSEH finally function wrapping a regular function */
#define _SEH_WRAP_FINALLY(WRAPPER_, NAME_) \
_SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ())
#define _SEH_WRAP_FINALLY_ARGS(WRAPPER_, NAME_, ARGS_) \
static __inline _SEH_FINALLYFUNC(WRAPPER_) \
{ \
NAME_ ARGS_; \
}
#define _SEH_WRAP_FINALLY_LOCALS_ARGS(WRAPPER_, LOCALS_, NAME_, ARGS_) \
static __inline _SEH_FINALLYFUNC(WRAPPER_) \
{ \
_SEH_ACCESS_LOCALS(LOCALS_); \
NAME_ ARGS_; \
}
/* SAFE BLOCKS */
#ifdef __cplusplus
# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \
static const _SEHHandlers_t _SEHHandlers = { (FILTER_), (FINALLY_) };
#else
# define _SEH_DECLARE_HANDLERS(FILTER_, FINALLY_) \
_SEHHandlers_t _SEHHandlers = { (0), (0) }; \
_SEHHandlers.SH_Filter = (FILTER_); \
_SEHHandlers.SH_Finally = (FINALLY_);
#endif
#define _SEH_SetExceptionCode(CODE_) (_SEHPortableFrame->SPF_Code = (CODE_))
#define _SEH_GetExceptionCode() (unsigned long)(_SEHPortableFrame->SPF_Code)
#define _SEH_GetExceptionPointers() \
((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
#define _SEH_AbnormalTermination() (_SEHPortableFrame->SPF_Code != 0)
#define _SEH_LEAVE break
#define _SEH_YIELD(STMT_) \
for(;;) \
{ \
if(!_SEHScopeKind) \
_SEHReturn(); \
\
STMT_; \
}
#ifdef _ARM_
#define _SEH_TRY \
for(;;) \
{ \
\
{ \
\
for(;;) \
{ \
if(1) \
{ \
for(;;) \
{ \
{
#define _SEH_EXCEPT(FILTER_) \
} \
\
break; \
} \
\
break; \
} \
else \
{ \
{ \
break; \
} \
} \
\
break; \
} \
\
\
if(0) \
{
#define _SEH_FINALLY(FINALLY_) \
} \
\
break; \
} \
\
break; \
} \
else \
{ \
} \
\
break; \
} \
\
(FINALLY_)(&_SEHFrame.SEH_Header); \
\
if(0) \
{
#define _SEH_END \
} \
} \
\
\
break; \
}
#else
#define _SEH_TRY \
for(;;) \
{ \
_SEH_INIT_CONST int _SEHTopTryLevel = (_SEHScopeKind != 0); \
_SEHPortableFrame_t * const _SEHCurPortableFrame = _SEHPortableFrame; \
_SEHPortableTryLevel_t * const _SEHPrevPortableTryLevel = _SEHPortableTryLevel; \
\
{ \
_SEH_INIT_CONST int _SEHScopeKind = 0; \
register int _SEHState = 0; \
register int _SEHHandle = 0; \
_SEHFrame_t _SEHFrame; \
_SEHTryLevel_t _SEHTryLevel; \
_SEHPortableFrame_t * const _SEHPortableFrame = \
_SEHTopTryLevel ? &_SEHFrame.SEH_Header : _SEHCurPortableFrame; \
_SEHPortableTryLevel_t * const _SEHPortableTryLevel = &_SEHTryLevel.ST_Header; \
\
(void)_SEHScopeKind; \
(void)_SEHPortableFrame; \
(void)_SEHPortableTryLevel; \
(void)_SEHHandle; \
\
for(;;) \
{ \
if(_SEHState) \
{ \
for(;;) \
{ \
{
#define _SEH_EXCEPT(FILTER_) \
} \
\
break; \
} \
\
break; \
} \
else \
{ \
if((_SEHHandle = _SEHSetJmp(_SEHTryLevel.ST_JmpBuf)) == 0) \
{ \
_SEHTryLevel.ST_Header.SPT_Handlers.SH_Filter = (FILTER_); \
_SEHTryLevel.ST_Header.SPT_Handlers.SH_Finally = 0; \
\
_SEHTryLevel.ST_Header.SPT_Next = _SEHPrevPortableTryLevel; \
_SEHFrame.SEH_Header.SPF_TopTryLevel = &_SEHTryLevel.ST_Header; \
\
if(_SEHTopTryLevel) \
{ \
if(&_SEHLocals != _SEHDummyLocals) \
_SEHFrame.SEH_Locals = &_SEHLocals; \
\
_SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \
_SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \
_SEHEnterFrame(&_SEHFrame.SEH_Header); \
} \
\
++ _SEHState; \
continue; \
} \
else \
{ \
break; \
} \
} \
\
break; \
} \
\
_SEHPortableFrame->SPF_TopTryLevel = _SEHPrevPortableTryLevel; \
\
if(_SEHHandle) \
{
#define _SEH_FINALLY(FINALLY_) \
} \
\
break; \
} \
\
_SEHPortableFrame->SPF_TopTryLevel = _SEHPrevPortableTryLevel; \
break; \
} \
else \
{ \
_SEHTryLevel.ST_Header.SPT_Handlers.SH_Filter = 0; \
_SEHTryLevel.ST_Header.SPT_Handlers.SH_Finally = (FINALLY_); \
\
_SEHTryLevel.ST_Header.SPT_Next = _SEHPrevPortableTryLevel; \
_SEHFrame.SEH_Header.SPF_TopTryLevel = &_SEHTryLevel.ST_Header; \
\
if(_SEHTopTryLevel) \
{ \
if(&_SEHLocals != _SEHDummyLocals) \
_SEHFrame.SEH_Locals = &_SEHLocals; \
\
_SEH_EnableTracing(_SEH_DO_DEFAULT_TRACING); \
_SEHFrame.SEH_Header.SPF_Handler = _SEHCompilerSpecificHandler; \
_SEHEnterFrame(&_SEHFrame.SEH_Header); \
} \
\
++ _SEHState; \
continue; \
} \
\
break; \
} \
\
(FINALLY_)(&_SEHFrame.SEH_Header); \
\
if(0) \
{
#define _SEH_END \
} \
} \
\
if(_SEHTopTryLevel) \
_SEHLeaveFrame(); \
\
break; \
}
#endif
#define _SEH_HANDLE _SEH_EXCEPT(_SEH_STATIC_FILTER(_SEH_EXECUTE_HANDLER))
#define _SEH_EnableTracing(LEVEL_) ((void)(_SEHPortableFrame->SPF_Tracing = (LEVEL_)))
#define _SEH_DisableTracing() ((void)(_SEHPortableFrame->SPF_Tracing = _SEH_DO_TRACE_NONE))
#endif
/* EOF */
|