1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avutil/avassert: always implement av_assume with av_unreachable

One of the design goals of this macro is the ability to support static
inline predicate functions. Which is emitting warning in clang that a
function may have side-effects and the condition will be ignored. MSVC
doesn't emit warning, but also ignore predicate in such cases.

Instead of using assume builtins, implement it using unreachable. Which
solves this case for MSVC and Clang.

This reverts ea56fe60ac, but also extends
it to MSVC, which is affected in the similar way.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow
2025-08-08 00:57:18 +02:00
committed by Leo Izen
parent 3ab9eebba7
commit 47c6af7d29

View File

@@ -108,16 +108,10 @@ do { \
#define av_unreachable(msg) ((void)0)
#endif
#if AV_HAS_BUILTIN(__builtin_assume)
#define av_assume(cond) __builtin_assume(cond)
#elif defined(_MSC_VER)
#define av_assume(cond) __assume(cond)
#else
#define av_assume(cond) do { \
if (!(cond)) \
av_unreachable(); \
} while (0)
#endif
#endif
#endif /* AVUTIL_AVASSERT_H */