On 5/16/25 16:06, Andreas Rheinhardt wrote:
Andreas Rheinhardt:
Patches attached.

- Andreas


Will apply this patchset tomorrow unless there are objections.

[PATCH 01/21] avutil/avassert: Add av_unreachable and av_assume() macros
diff --git a/libavutil/avassert.h b/libavutil/avassert.h
index 1895fb7551..d0d5aa0c7e 100644
--- a/libavutil/avassert.h
+++ b/libavutil/avassert.h
@@ -75,4 +76,45 @@
  */
 void av_assert0_fpu(void);
+/**
+ * Asserts that are used as compiler optimization hints depending
+ * upon ASSERT_LEVEL and NBDEBUG.
+ *
+ * Undefined behaviour occurs if execution reaches a point marked
+ * with av_unreachable() or if a condition used with av_assume()
+ * is false.
+ *
+ * The condition used with av_assume() should not have side-effects
+ * and should be visible to the compiler.
+ */
+#if defined(ASSERT_LEVEL) ? ASSERT_LEVEL > 0 : !defined(HAVE_AV_CONFIG_H) && 
!defined(NDEBUG)
+#define av_unreachable(msg)    \
+do {                           \
+    av_log(NULL, AV_LOG_PANIC, \
+           "Code at %s:%d that was supposedly unreachable due to '%s' 
reached\n", \
+           __FILE__, __LINE__, msg); \

The message sounds weird (especially that dangling "reached" at the end). What about:
"Reached supposedly unreachable code at %s:%d: %s\n"
or any other variation where the reason message gets printed at the end.

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to