From 52bc3abb1bbc28825019dbbcb94a3171f7491441 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 22 Apr 2019 13:55:43 +0200 Subject: [PATCH] include/msvcrt: Add noreturn attributes. Signed-off-by: Alexandre Julliard --- include/msvcrt/crtdefs.h | 10 ++++++++++ include/msvcrt/eh.h | 4 ++-- include/msvcrt/process.h | 10 +++++----- include/msvcrt/stdlib.h | 8 ++++---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/msvcrt/crtdefs.h b/include/msvcrt/crtdefs.h index 0c0b08748ea..653d4594f74 100644 --- a/include/msvcrt/crtdefs.h +++ b/include/msvcrt/crtdefs.h @@ -117,6 +117,16 @@ # endif #endif +#ifndef DECLSPEC_NORETURN +# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS) +# define DECLSPEC_NORETURN __declspec(noreturn) +# elif defined(__GNUC__) +# define DECLSPEC_NORETURN __attribute__((noreturn)) +# else +# define DECLSPEC_NORETURN +# 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/eh.h b/include/msvcrt/eh.h index 932972fa69b..90f88961773 100644 --- a/include/msvcrt/eh.h +++ b/include/msvcrt/eh.h @@ -40,8 +40,8 @@ terminate_function __cdecl set_terminate(terminate_function func); unexpected_function __cdecl set_unexpected(unexpected_function func); _se_translator_function __cdecl set_se_translator(_se_translator_function func); -void __cdecl terminate(void); -void __cdecl unexpected(void); +void __cdecl terminate(void) DECLSPEC_NORETURN; +void __cdecl unexpected(void) DECLSPEC_NORETURN; #include diff --git a/include/msvcrt/process.h b/include/msvcrt/process.h index 3cae11200ad..4d286f69469 100644 --- a/include/msvcrt/process.h +++ b/include/msvcrt/process.h @@ -30,8 +30,8 @@ typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *); uintptr_t __cdecl _beginthread(_beginthread_start_routine_t,unsigned int,void*); uintptr_t __cdecl _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*); intptr_t __cdecl _cwait(int*,intptr_t,int); -void __cdecl _endthread(void); -void __cdecl _endthreadex(unsigned int); +void __cdecl _endthread(void) DECLSPEC_NORETURN; +void __cdecl _endthreadex(unsigned int) DECLSPEC_NORETURN; intptr_t WINAPIV _execl(const char*,const char*,...); intptr_t WINAPIV _execle(const char*,const char*,...); intptr_t WINAPIV _execlp(const char*,const char*,...); @@ -52,9 +52,9 @@ intptr_t __cdecl _spawnvpe(int,const char*,const char* const *,const char* cons void __cdecl _c_exit(void); void __cdecl _cexit(void); -void __cdecl _exit(int); -void __cdecl abort(void); -void __cdecl exit(int); +void __cdecl _exit(int) DECLSPEC_NORETURN; +void __cdecl abort(void) DECLSPEC_NORETURN; +void __cdecl exit(int) DECLSPEC_NORETURN; int __cdecl system(const char*); #ifndef _WPROCESS_DEFINED diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index bc7c86e7744..3454b17c933 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -184,9 +184,9 @@ errno_t __cdecl _ui64toa_s(unsigned __int64,char*,size_t,int); char* __cdecl _ultoa(__msvcrt_ulong,char*,int); errno_t __cdecl _ultoa_s(__msvcrt_ulong,char*,size_t,int); -void __cdecl _Exit(int); -void __cdecl _exit(int); -void __cdecl abort(void); +void __cdecl _Exit(int) DECLSPEC_NORETURN; +void __cdecl _exit(int) DECLSPEC_NORETURN; +void __cdecl abort(void) DECLSPEC_NORETURN; int __cdecl abs(int); int __cdecl atexit(void (__cdecl *)(void)); double __cdecl atof(const char*); @@ -200,7 +200,7 @@ div_t __cdecl div(int,int); ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); #endif lldiv_t __cdecl lldiv(__int64,__int64); -void __cdecl exit(int); +void __cdecl exit(int) DECLSPEC_NORETURN; void __cdecl free(void*); char* __cdecl getenv(const char*); __msvcrt_long __cdecl labs(__msvcrt_long);