From 92c4b0651368a4135f692af48f4716c96de4bd92 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 16 Jun 2020 16:29:05 +0200 Subject: Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0) Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce `ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)` to mark unreachable code does no longer trigger C4715[1] warnings in debug builds. This may be useful for other compilers as well. [1] --- ext/gd/gd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/gd') diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 4089e40691..d915398c7b 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1872,7 +1872,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char (*func_p)(im, fp, q, t); break; default: - ZEND_ASSERT(0); + ZEND_UNREACHABLE(); } fflush(fp); fclose(fp); @@ -1899,7 +1899,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char (*func_p)(im, tmp, q, t); break; default: - ZEND_ASSERT(0); + ZEND_UNREACHABLE(); } fseek(tmp, 0, SEEK_SET); -- cgit v1.2.1