add __dead__ annotation support

This commit is contained in:
Brent Cook 2019-02-09 09:03:13 -06:00
parent 5535242ec1
commit 535246269d
3 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,7 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__) add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__)
add_definitions(-DHAVE_ATTRIBUTE__DEAD__)
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")

View File

@ -49,6 +49,14 @@ typedef SSIZE_T ssize_t;
# define __bounded__(x, y, z) # define __bounded__(x, y, z)
#endif #endif
#if !defined(HAVE_ATTRIBUTE__DEAD) && !defined(__dead)
#ifdef _MSC_VER
#define __dead __declspec(noreturn)
#else
#define __dead __attribute__((__noreturn__))
#endif
#endif
#ifdef _WIN32 #ifdef _WIN32
#define __warn_references(sym,msg) #define __warn_references(sym,msg)
#else #else

View File

@ -98,6 +98,7 @@ char buf[1]; getentropy(buf, 1);
HOST_OS=openbsd HOST_OS=openbsd
HOST_ABI=elf HOST_ABI=elf
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
AC_DEFINE([HAVE_ATTRIBUTE__DEAD], [1], [OpenBSD gcc has __dead])
;; ;;
*mingw*) *mingw*)
HOST_OS=win HOST_OS=win