[PATCH SBC] sbc_primitives: Fix build on non-x86 arch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

Check if SBC_BUILD_WITH_MMX_SUPPORT is defined otherwise
sbc_init_primitives_mmx will not be declared and
_builtin_cpu_supports(“mmx”)) likely fail:

CC    sbc/sbc_primitives.lo
sbc/sbc_primitives.c: In function ‘sbc_init_primitives_x86’:
sbc/sbc_primitives.c:599:3: warning: implicit declaration of function
‘sbc_init_primitives_mmx’; did you mean ‘sbc_init_primitives_x86’?
[-Wimplicit-function-declaration]
 599 |  sbc_init_primitives_mmx(state);
   |  ^~~~~~~~~~~~~~~~~~~~~~~
   |  sbc_init_primitives_x86
sbc/sbc_primitives.c: In function ‘sbc_init_primitives’:
sbc/sbc_primitives.c:598:6: error: hwcap ‘mmx’ is an invalid argument to
builtin ‘__builtin_cpu_supports’
 598 | if (__builtin_cpu_supports(“mmx”))
   |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:711: sbc/sbc_primitives.lo] Error 1
make: *** [Makefile:453: all] Error 2
---
 sbc/sbc_primitives.c     | 2 ++
 sbc/sbc_primitives_mmx.c | 5 -----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/sbc/sbc_primitives.c b/sbc/sbc_primitives.c
index c9d1045..97a75be 100644
--- a/sbc/sbc_primitives.c
+++ b/sbc/sbc_primitives.c
@@ -595,8 +595,10 @@ static void sbc_init_primitives_x86(struct sbc_encoder_state *state)
 {
 	__builtin_cpu_init();
 
+#ifdef SBC_BUILD_WITH_MMX_SUPPORT
 	if (__builtin_cpu_supports("mmx"))
 		sbc_init_primitives_mmx(state);
+#endif
 
 #ifdef SBC_BUILD_WITH_SSE_SUPPORT
 	if (__builtin_cpu_supports("sse4.2"))
diff --git a/sbc/sbc_primitives_mmx.c b/sbc/sbc_primitives_mmx.c
index 6984ce5..c7655ac 100644
--- a/sbc/sbc_primitives_mmx.c
+++ b/sbc/sbc_primitives_mmx.c
@@ -360,9 +360,4 @@ void sbc_init_primitives_mmx(struct sbc_encoder_state *state)
 	state->sbc_calc_scalefactors = sbc_calc_scalefactors_mmx;
 	state->implementation_info = "MMX";
 }
-
-#else
-void sbc_init_primitives_mmx(struct sbc_encoder_state *state)
-{
-}
 #endif
-- 
2.26.2




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux