fix warning about noreturn in sanitizer_win's internal__exit()

Summary:
A previous fix used __assume(0), but not all compilers know that control will
not pass that. This patch uses a macro which works in more compilers.

Reviewers: rnk

Subscribers: kubabrecka

Differential Revision: https://reviews.llvm.org/D28268

llvm-svn: 291042
This commit is contained in:
Bob Haarman 2017-01-05 00:37:13 +00:00
parent 521ed960ed
commit 71a7323b5a
1 changed files with 15 additions and 1 deletions

View File

@ -31,6 +31,20 @@
#include "sanitizer_stacktrace.h"
#include "sanitizer_symbolizer.h"
// A macro to tell the compiler that this part of the code cannot be reached,
// if the compiler supports this feature. Since we're using this in
// code that is called when terminating the process, the expansion of the
// macro should not terminate the process to avoid infinite recursion.
#if defined(__clang__)
# define BUILTIN_UNREACHABLE() __builtin_unreachable()
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define BUILTIN_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
# define BUILTIN_UNREACHABLE() __assume(0)
#else
# define BUILTIN_UNREACHABLE()
#endif
namespace __sanitizer {
#include "sanitizer_syscall_generic.inc"
@ -659,7 +673,7 @@ void internal__exit(int exitcode) {
if (::IsDebuggerPresent())
__debugbreak();
TerminateProcess(GetCurrentProcess(), exitcode);
__assume(0);
BUILTIN_UNREACHABLE();
}
uptr internal_ftruncate(fd_t fd, uptr size) {