summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2021-10-25 10:49:11 +0200
committerNiklas Haas <github-daiK1o@haasn.dev>2021-11-03 14:09:27 +0100
commitc704824b45731f2400355ebe8ae0c576e19dc072 (patch)
treec9410eb47d37fa0b0d5d43af34e6998f3114d1b6 /video
parent210767169191e19c70f9c7b63528b0d629ddbcfa (diff)
downloadmpv-c704824b45731f2400355ebe8ae0c576e19dc072.tar.bz2
mpv-c704824b45731f2400355ebe8ae0c576e19dc072.tar.xz
osdep: add MP_UNREACHABLE
This seems to work on gcc, clang and mingw as-is, but I made it conditional on __GNUC__ just in case, even though I can't figure out which compilers we care about that don't export this define. Also replace all instances of assert(0) in the code by MP_UNREACHABLE(), which is a strict improvement.
Diffstat (limited to 'video')
-rw-r--r--video/mp_image.c2
-rw-r--r--video/out/gpu/video.c2
-rw-r--r--video/repack.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 0e95a59808..e8d433cbfe 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -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));
break;
default:
- assert(0);
+ MP_UNREACHABLE();
}
return true;
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 5d6b766d36..43fff511a1 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -4237,7 +4237,7 @@ static void gl_video_dr_free_buffer(void *opaque, uint8_t *data)
}
}
// not found - must not happen
- assert(0);
+ MP_UNREACHABLE();
}
struct mp_image *gl_video_get_image(struct gl_video *p, int imgfmt, int w, int h,
diff --git a/video/repack.c b/video/repack.c
index ed78981b3c..7973208caf 100644
--- a/video/repack.c
+++ b/video/repack.c
@@ -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]);
break;
default:
- assert(0);
+ MP_UNREACHABLE();
}
}
}