[PATCH 6/6] Make pulse compile with clang

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

 



This fixes the checking of supported compiler flags and the following error message for svolume_mmx:

pulsecore/svolume_mmx.c:157:76: error: invalid use of a cast in a inline asm context requiring an l-value:
  remove the cast or build with -fheinous-gnu-extensions
        : "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((pa_reg_x86)channel), "=&r" (temp)
                                                               ~~~~~~~~~~~~^~~~~~~
---
 configure.ac                |    6 ++++++
 src/pulsecore/svolume_mmx.c |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index fd76c6b..70820bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,13 @@ if test "x$M4" = xno ; then
 fi
 
 dnl Compiler flags
+
+# Some compilers (e.g. clang) default to a warning on an unkown command line option.
+# Change that temporarily to an error, for the CC_CHECK_CFLAGS_APPEND macro to work.
+save_CC="$CC"
+CC="$CC -Werror"
 CC_CHECK_CFLAGS_APPEND([-Wall -W -Wextra -pipe -Wno-long-long -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option])
+CC="$save_CC"
 
 dnl Linker flags.
 dnl Check whether the linker supports the -version-script option.
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index 4f10954..421156e 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -154,7 +154,7 @@ static void pa_volume_s16ne_mmx(int16_t *samples, int32_t *volumes, unsigned cha
         "6:                             \n\t"
         " emms                          \n\t"
 
-        : "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((pa_reg_x86)channel), "=&r" (temp)
+        : "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
         : "rm" ((pa_reg_x86)channels)
         : "cc"
     );
@@ -229,7 +229,7 @@ static void pa_volume_s16re_mmx(int16_t *samples, int32_t *volumes, unsigned cha
         "6:                             \n\t"
         " emms                          \n\t"
 
-        : "+r" (samples), "+r" (volumes), "+r" (length), "=D" ((pa_reg_x86)channel), "=&r" (temp)
+        : "+r" (samples), "+r" (volumes), "+r" (length), "=D" (channel), "=&r" (temp)
         : "rm" ((pa_reg_x86)channels)
         : "cc"
     );
-- 
1.7.1




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux