diff mbox series

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

Message ID 20201203212947.2680393-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [SBC] sbc_primitives: Fix build on non-x86 arch | expand

Commit Message

Luiz Augusto von Dentz Dec. 3, 2020, 9:29 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

Comments

Marcel Holtmann Dec. 3, 2020, 9:59 p.m. UTC | #1
Hi Luiz,

> 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(-)

patch has been applied.

Regards

Marcel
diff mbox series

Patch

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