diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-16 16:29:05 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-16 18:39:09 +0200 |
| commit | 92c4b0651368a4135f692af48f4716c96de4bd92 (patch) | |
| tree | 052276ba1af9bcf5fd113f9bf8d6d93075d69aa3 /sapi | |
| parent | 9ff3230c20f27ac35788aca72f16ff928a25f81b (diff) | |
| download | php-git-92c4b0651368a4135f692af48f4716c96de4bd92.tar.gz | |
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] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/fpm/fpm/fpm_php_trace.c | 2 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_watch.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sapi/fpm/fpm/fpm_php_trace.c b/sapi/fpm/fpm/fpm_php_trace.c index 0437026a06..0e1d8e3f6c 100644 --- a/sapi/fpm/fpm/fpm_php_trace.c +++ b/sapi/fpm/fpm/fpm_php_trace.c @@ -100,7 +100,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ * } else if (ZEND_CALL_KIND_EX(*call_info) == ZEND_CALL_NESTED_CODE) { memcpy(buf, "[INCLUDE_OR_EVAL]", sizeof("[INCLUDE_OR_EVAL]")); } else { - ZEND_ASSERT(0); + ZEND_UNREACHABLE(); } } else { if (0 > fpm_trace_get_strz(buf, buf_size, function_name + offsetof(zend_string, val))) { diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index a9511fc742..af8de17096 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -142,7 +142,7 @@ zend_bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *new case WATCH_ON_STR: return memcmp(oldPtr, newPtr, *(size_t *) oldPtr + XtOffsetOf(zend_string, val) - XtOffsetOf(zend_string, len)) != 0; case WATCH_ON_HASHDATA: - ZEND_ASSERT(0); + ZEND_UNREACHABLE(); } return 0; } @@ -210,7 +210,7 @@ void phpdbg_print_watch_diff(phpdbg_watchtype type, zend_string *name, void *old break; case WATCH_ON_HASHDATA: - ZEND_ASSERT(0); + ZEND_UNREACHABLE(); } phpdbg_xml("</watchdata>"); |
