summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-12-03 13:29:47 -0800
committerMarcel Holtmann <marcel@holtmann.org>2020-12-03 22:57:59 +0100
commit76f4d931d237517c443dd793390ed7d73b12746e (patch)
tree340e8f8738d8fd358435046e916069965d02f581
parent10310fb983b0fced7db7bdb2d14ec03c252f8a88 (diff)
downloadsbc-76f4d931d237517c443dd793390ed7d73b12746e.tar.gz
sbc_primitives: Fix build on non-x86 arch
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
-rw-r--r--sbc/sbc_primitives.c2
-rw-r--r--sbc/sbc_primitives_mmx.c5
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