Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/msvcrt/corecrt.h | 18 ++++++++++++++++++ include/msvcrt/setjmp.h | 8 ++------ include/wine/exception.h | 4 ++-- include/wine/unixlib.h | 4 ++-- include/winnt.h | 8 ++++++++ 5 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index e61a22dccd7..7e0cd8a548a 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -152,6 +152,24 @@ # endif #endif
+#ifndef DECLSPEC_NOTHROW +# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS) +# define DECLSPEC_NOTHROW __declspec(nothrow) +# elif defined(__GNUC__) +# define DECLSPEC_NOTHROW __attribute__((nothrow)) +# else +# define DECLSPEC_NOTHROW +# endif +#endif + +#ifndef DECLSPEC_RETURNS_TWICE +# if defined(__GNUC__) +# define DECLSPEC_RETURNS_TWICE __attribute__((returns_twice)) +# else +# define DECLSPEC_RETURNS_TWICE +# endif +#endif + #ifndef DECLSPEC_ALIGN # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) # define DECLSPEC_ALIGN(x) __declspec(align(x)) diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h index 6576605cf1b..410852734cd 100644 --- a/include/msvcrt/setjmp.h +++ b/include/msvcrt/setjmp.h @@ -152,7 +152,7 @@ _ACRTIMP void __cdecl longjmp(jmp_buf,int); # define _setjmpex __intrinsic_setjmpex # endif # if defined(__GNUC__) || defined(__clang__) -_ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(jmp_buf,void*); +_ACRTIMP int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl _setjmpex(jmp_buf,void*); # define setjmp(buf) _setjmpex(buf,__builtin_frame_address(0)) # define setjmpex(buf) _setjmpex(buf,__builtin_frame_address(0)) # endif @@ -160,11 +160,7 @@ _ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(j # ifdef _UCRT # define _setjmp __intrinsic_setjmp # endif -# if defined(__GNUC__) || defined(__clang__) -_ACRTIMP int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf); -# else -_ACRTIMP int __cdecl _setjmp(jmp_buf); -# endif +_ACRTIMP int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl _setjmp(jmp_buf); #endif /* _WIN64 */
#ifndef setjmp diff --git a/include/wine/exception.h b/include/wine/exception.h index 812b4641d62..4d42d84dbd3 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -104,8 +104,8 @@ typedef struct { __int64 reg[24]; } __wine_jmp_buf; typedef struct { int reg; } __wine_jmp_buf; #endif
-extern int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __wine_setjmpex( __wine_jmp_buf *buf, - EXCEPTION_REGISTRATION_RECORD *frame ) DECLSPEC_HIDDEN; +extern int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl __wine_setjmpex( __wine_jmp_buf *buf, + EXCEPTION_REGISTRATION_RECORD *frame ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN __cdecl __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record, void (*target)(void) ) DECLSPEC_HIDDEN; diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index 920e3d32dc5..e85ee1303b7 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -49,8 +49,8 @@ typedef struct { __int64 reg[24]; } __wine_jmp_buf; typedef struct { int reg; } __wine_jmp_buf; #endif
-extern int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __wine_setjmpex( __wine_jmp_buf *buf, - EXCEPTION_REGISTRATION_RECORD *frame ); +extern int DECLSPEC_NOTHROW DECLSPEC_RETURNS_TWICE __cdecl __wine_setjmpex( __wine_jmp_buf *buf, + EXCEPTION_REGISTRATION_RECORD *frame ); extern void DECLSPEC_NORETURN __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval ); extern void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp );
diff --git a/include/winnt.h b/include/winnt.h index ef731e29c52..d0558935ed9 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -93,6 +93,14 @@ extern "C" { # endif #endif
+#ifndef DECLSPEC_RETURNS_TWICE +# if defined(__GNUC__) +# define DECLSPEC_RETURNS_TWICE __attribute__((returns_twice)) +# else +# define DECLSPEC_RETURNS_TWICE +# endif +#endif + #ifndef DECLSPEC_CACHEALIGN # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128) #endif