fix: make UNREACHABLE() macro safe on compilers lacking __builtin_unreachable

Add fallback empty UNREACHABLE() definition for GCC < 4.5 and non-MSVC compilers, and insert return/break statements after all UNREACHABLE() calls to prevent -Wreturn-type warnings when the macro expands to nothing. Also cast malloc result to char* in io.c to suppress C++ compilation warning.
This commit is contained in:
Bob Nystrom
2015-10-17 04:51:30 +00:00
parent 98f328c09f
commit 0f932e1f3a
7 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ static void allocCallback(uv_handle_t* handle, size_t suggestedSize,
uv_buf_t* buf)
{
// TODO: Handle allocation failure.
buf->base = malloc(suggestedSize);
buf->base = (char*)malloc(suggestedSize);
buf->len = suggestedSize;
}