osdep: rename MP_UNREACHABLE

It was pointed out on IRC that the name is misleading, since the actual
semantics of the macro is to assert first.
This commit is contained in:
Niklas Haas 2021-11-03 15:15:20 +01:00
parent 701bd783ca
commit 8bd0dee531
14 changed files with 22 additions and 22 deletions

View File

@ -1506,7 +1506,7 @@ static void find_backward_restart_pos(struct demux_stream *ds)
// Or if preroll is involved, the first preroll packet. // Or if preroll is involved, the first preroll packet.
while (ds->reader_head != target) { while (ds->reader_head != target) {
if (!advance_reader_head(ds)) if (!advance_reader_head(ds))
MP_UNREACHABLE(); // target must be in list MP_ASSERT_UNREACHABLE(); // target must be in list
} }
double seek_pts; double seek_pts;

View File

@ -2872,7 +2872,7 @@ static int read_next_block_into_queue(demuxer_t *demuxer)
if (mkv_d->cluster_end != EBML_UINT_INVALID) if (mkv_d->cluster_end != EBML_UINT_INVALID)
mkv_d->cluster_end += stream_tell(s); mkv_d->cluster_end += stream_tell(s);
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
add_block: add_block:
index_block(demuxer, &block); index_block(demuxer, &block);

View File

@ -394,7 +394,7 @@ static bool init_pads(struct lavfi *c)
} else if (pad->type == MP_FRAME_VIDEO) { } else if (pad->type == MP_FRAME_VIDEO) {
dst_filter = avfilter_get_by_name("buffersink"); dst_filter = avfilter_get_by_name("buffersink");
} else { } else {
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
if (!dst_filter) if (!dst_filter)
@ -484,7 +484,7 @@ static bool init_pads(struct lavfi *c)
params->frame_rate = av_d2q(fmt->nominal_fps, 1000000); params->frame_rate = av_d2q(fmt->nominal_fps, 1000000);
filter_name = "buffer"; filter_name = "buffer";
} else { } else {
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
params->time_base = pad->timebase; params->time_base = pad->timebase;

View File

@ -250,7 +250,7 @@ static void fixed_aframe_size_process(struct mp_filter *f)
int in_samples = mp_aframe_get_size(p->in); int in_samples = mp_aframe_get_size(p->in);
int copy = MPMIN(in_samples, p->samples - p->out_written); int copy = MPMIN(in_samples, p->samples - p->out_written);
if (!mp_aframe_copy_samples(p->out, p->out_written, p->in, 0, copy)) if (!mp_aframe_copy_samples(p->out, p->out_written, p->in, 0, copy))
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
mp_aframe_skip_samples(p->in, copy); mp_aframe_skip_samples(p->in, copy);
p->out_written += copy; p->out_written += copy;
} }

View File

@ -372,7 +372,7 @@ static struct mp_pin *find_connected_end(struct mp_pin *p)
return other; return other;
p = other->user_conn; p = other->user_conn;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
// With p being part of a connection, create the pin_connection and set all // With p being part of a connection, create the pin_connection and set all

View File

@ -105,7 +105,7 @@ static void *worker_thread(void *arg)
return NULL; return NULL;
} }
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
pthread_mutex_unlock(&pool->lock); pthread_mutex_unlock(&pool->lock);

View File

@ -879,7 +879,7 @@ void mp_read_option_raw(struct mpv_global *global, const char *name,
} }
} }
MP_UNREACHABLE(); // not found MP_ASSERT_UNREACHABLE(); // not found
} }
static const struct m_config_group *find_group(struct mpv_global *global, static const struct m_config_group *find_group(struct mpv_global *global,

View File

@ -176,7 +176,7 @@ static bstr read_file(struct mp_log *log, const char *filename)
} }
size += s; size += s;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
// Load options and profiles from from a config file. // Load options and profiles from from a config file.

View File

@ -24,9 +24,9 @@
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
#define MP_UNREACHABLE() (assert(!"unreachable"), __builtin_unreachable()) #define MP_ASSERT_UNREACHABLE() (assert(!"unreachable"), __builtin_unreachable())
#else #else
#define MP_UNREACHABLE() (assert(!"unreachable"), abort()) #define MP_ASSERT_UNREACHABLE() (assert(!"unreachable"), abort())
#endif #endif
#endif #endif

View File

@ -155,7 +155,7 @@ static void hook_remove(struct MPContext *mpctx, struct hook_handler *h)
return; return;
} }
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
bool mp_hook_test_completion(struct MPContext *mpctx, char *type) bool mp_hook_test_completion(struct MPContext *mpctx, char *type)

View File

@ -593,7 +593,7 @@ static bool endian_swap_bytes(void *d, size_t bytes, size_t word_size)
AV_WL32(ud + x * 2, AV_RB32(ud + x * 2)); AV_WL32(ud + x * 2, AV_RB32(ud + x * 2));
break; break;
default: default:
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
return true; return true;

View File

@ -4237,7 +4237,7 @@ static void gl_video_dr_free_buffer(void *opaque, uint8_t *data)
} }
} }
// not found - must not happen // not found - must not happen
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h, struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,

View File

@ -79,7 +79,7 @@ enum pl_color_primaries mp_prim_to_pl(enum mp_csp_prim prim)
case MP_CSP_PRIM_COUNT: return PL_COLOR_PRIM_COUNT; case MP_CSP_PRIM_COUNT: return PL_COLOR_PRIM_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_color_transfer mp_trc_to_pl(enum mp_csp_trc trc) enum pl_color_transfer mp_trc_to_pl(enum mp_csp_trc trc)
@ -104,7 +104,7 @@ enum pl_color_transfer mp_trc_to_pl(enum mp_csp_trc trc)
case MP_CSP_TRC_COUNT: return PL_COLOR_TRC_COUNT; case MP_CSP_TRC_COUNT: return PL_COLOR_TRC_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_color_light mp_light_to_pl(enum mp_csp_light light) enum pl_color_light mp_light_to_pl(enum mp_csp_light light)
@ -118,7 +118,7 @@ enum pl_color_light mp_light_to_pl(enum mp_csp_light light)
case MP_CSP_LIGHT_COUNT: return PL_COLOR_LIGHT_COUNT; case MP_CSP_LIGHT_COUNT: return PL_COLOR_LIGHT_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_color_system mp_csp_to_pl(enum mp_csp csp) enum pl_color_system mp_csp_to_pl(enum mp_csp csp)
@ -136,7 +136,7 @@ enum pl_color_system mp_csp_to_pl(enum mp_csp csp)
case MP_CSP_COUNT: return PL_COLOR_SYSTEM_COUNT; case MP_CSP_COUNT: return PL_COLOR_SYSTEM_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_color_levels mp_levels_to_pl(enum mp_csp_levels levels) enum pl_color_levels mp_levels_to_pl(enum mp_csp_levels levels)
@ -148,7 +148,7 @@ enum pl_color_levels mp_levels_to_pl(enum mp_csp_levels levels)
case MP_CSP_LEVELS_COUNT: return PL_COLOR_LEVELS_COUNT; case MP_CSP_LEVELS_COUNT: return PL_COLOR_LEVELS_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_alpha_mode mp_alpha_to_pl(enum mp_alpha_type alpha) enum pl_alpha_mode mp_alpha_to_pl(enum mp_alpha_type alpha)
@ -161,7 +161,7 @@ enum pl_alpha_mode mp_alpha_to_pl(enum mp_alpha_type alpha)
case MP_ALPHA_PREMUL: return PL_ALPHA_PREMULTIPLIED; case MP_ALPHA_PREMUL: return PL_ALPHA_PREMULTIPLIED;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
enum pl_chroma_location mp_chroma_to_pl(enum mp_chroma_location chroma) enum pl_chroma_location mp_chroma_to_pl(enum mp_chroma_location chroma)
@ -174,5 +174,5 @@ enum pl_chroma_location mp_chroma_to_pl(enum mp_chroma_location chroma)
case MP_CHROMA_COUNT: return PL_CHROMA_COUNT; case MP_CHROMA_COUNT: return PL_CHROMA_COUNT;
} }
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }

View File

@ -169,7 +169,7 @@ static void swap_endian(struct mp_image *dst, int dst_x, int dst_y,
((uint32_t *)d)[x] = av_bswap32(((uint32_t *)s)[x]); ((uint32_t *)d)[x] = av_bswap32(((uint32_t *)s)[x]);
break; break;
default: default:
MP_UNREACHABLE(); MP_ASSERT_UNREACHABLE();
} }
} }
} }