diff mbox series

[FFmpeg-devel] avutil/x86/emms: Don't unnecessarily include lavu/cpu.h

Message ID PR3PR03MB6665D6B3862F43ABB2A9B0158F339@PR3PR03MB6665.eurprd03.prod.outlook.com
State Accepted
Commit 6c694074e1d1de12ecc4f4c05cb7431425a86b60
Headers show
Series [FFmpeg-devel] avutil/x86/emms: Don't unnecessarily include lavu/cpu.h | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 14, 2022, 6:41 p.m. UTC
Only include it if it is needed, namely if __MMX__ is undefined.

X86 is currently the only arch where lavu/cpu.h is basically
automatically included (for internal development): #if ARCH_X86
is true, lavu/internal.h (which is basically included everywhere)
includes lavu/x86/emms.h which can mask missing inclusions
of lavu/cpu.h if the developer works on x86/x64. This has happened
in 8e825ec3ab09d877f12dcf05d76902a8bb9c8b11 and also earlier
(see 6d2365882f281f9452b31b91edb2e6a2d4f5ff08).
By including said header only if necessary ordinary developer machines
will behave like non-x86 arches, so that missing inclusions of cpu.h
won't go unnoticed any more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/x86/emms.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/x86/emms.h b/libavutil/x86/emms.h
index c21e34b451..8ceec110cf 100644
--- a/libavutil/x86/emms.h
+++ b/libavutil/x86/emms.h
@@ -21,11 +21,14 @@ 
 
 #include "config.h"
 #include "libavutil/attributes.h"
-#include "libavutil/cpu.h"
 
 void avpriv_emms_asm(void);
 
 #if HAVE_MMX_INLINE
+#ifndef __MMX__
+#include "libavutil/cpu.h"
+#endif
+
 #   define emms_c emms_c
 /**
  * Empty mmx state.