From b2e5794870eb4728ddfaafc0f79a40299576434f Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 14 Sep 2017 18:13:16 -0700 Subject: bpo-31338 (#3374) * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros. --- Python/pytime.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Python/pytime.c') diff --git a/Python/pytime.c b/Python/pytime.c index 7edb534596..8f275d2983 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -630,10 +630,7 @@ _PyTime_GetSystemClock(void) _PyTime_t t; if (pygettimeofday(&t, NULL, 0) < 0) { /* should not happen, _PyTime_Init() checked the clock at startup */ - assert(0); - - /* use a fixed value instead of a random value from the stack */ - t = 0; + Py_UNREACHABLE(); } return t; } @@ -663,7 +660,7 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) return -1; } /* Hello, time traveler! */ - assert(0); + Py_UNREACHABLE(); } *tp = t * MS_TO_NS; @@ -771,10 +768,7 @@ _PyTime_GetMonotonicClock(void) if (pymonotonic(&t, NULL, 0) < 0) { /* should not happen, _PyTime_Init() checked that monotonic clock at startup */ - assert(0); - - /* use a fixed value instead of a random value from the stack */ - t = 0; + Py_UNREACHABLE(); } return t; } -- cgit v1.2.1