[vlc-devel] [PATCH] Fix building with LLVM

Brad Smith brad at comstyle.com
Mon Jan 14 14:43:36 CET 2013


On Mon, Jan 14, 2013 at 02:23:32PM +0100, Rafa?l Carr? wrote:
> Le 2013-01-14 10:34, Brad Smith a ?crit :
> >On Mon, Jan 07, 2013 at 02:16:28PM -0500, Brad Smith wrote:
> >>On Sat, Jan 05, 2013 at 03:11:28AM -0500, Brad Smith wrote:
> >>>On Fri, Jan 04, 2013 at 10:37:02PM -0500, Brad Smith wrote:
> >>>>On Thu, Jan 03, 2013 at 11:39:52AM +0100, Jean-Baptiste Kempf wrote:
> >>>>>On 03 Jan, Brad Smith wrote :
> >>>>>>The following diff provides some fixes for VLC to allow building
> >>>>>>with LLVM.
> >>>>>
> >>>>>LLVM or clang?
> >>>>
> >>>>Well Clang is the C/C++/ObjC frontend and LLVM is the backend
> >>>>as well as the project name.
> >>>>
> >>>>>All versions of clang work?
> >>>>
> >>>>I have only built this with LLVM 3.2 so far. I'm building 3.0 now
> >>>>which was the first release to ship with Clang and will build VLC
> >>>>with that as well to make sure it is Ok with 3.0.
> >>>
> >>>Ok, this builds fine with 3.0 / 3.1 and 3.2
> >>
> >>Also please bring this back to the 2.0 branch.
> >
> >I haven't seen anything commited yet but please back port this
> >to the 2.0 branch. I don't want this to miss the next release.
> 
> It doesn't apply as-is, can you send a patch for 2.0 ?

Sure thing. Patch attached.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 015a4ba..8e87a96 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -661,7 +661,7 @@ static inline uint16_t bswap16 (uint16_t x)
 VLC_USED
 static inline uint32_t bswap32 (uint32_t x)
 {
-#if VLC_GCC_VERSION(4,3)
+#if VLC_GCC_VERSION(4,3) || defined(__clang__)
     return __builtin_bswap32 (x);
 #else
     return ((x & 0x000000FF) << 24)
@@ -675,7 +675,7 @@ static inline uint32_t bswap32 (uint32_t x)
 VLC_USED
 static inline uint64_t bswap64 (uint64_t x)
 {
-#if VLC_GCC_VERSION(4,3)
+#if VLC_GCC_VERSION(4,3) || defined(__clang__)
     return __builtin_bswap64 (x);
 #elif !defined (__cplusplus)
     return ((x & 0x00000000000000FF) << 56)
diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h
index 36f8da5..6c82004 100644
--- a/include/vlc_cpu.h
+++ b/include/vlc_cpu.h
@@ -40,7 +40,7 @@
 
 # if defined (__MMX__)
 #  define VLC_MMX
-# elif VLC_GCC_VERSION(4, 4)
+# elif VLC_GCC_VERSION(4, 4) || defined(__clang__)
 #  define VLC_MMX __attribute__ ((__target__ ("mmx")))
 # else
 #  define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler
@@ -48,7 +48,7 @@
 
 # if defined (__SSE__)
 #  define VLC_SSE
-# elif VLC_GCC_VERSION(4, 4)
+# elif VLC_GCC_VERSION(4, 4) || defined(__clang__)
 #  define VLC_SSE __attribute__ ((__target__ ("sse")))
 # else
 #  define VLC_SSE VLC_SSE_is_not_implemented_on_this_compiler
diff --git a/modules/video_filter/deinterlace/yadif.h b/modules/video_filter/deinterlace/yadif.h
index a2fccac..233504e 100644
--- a/modules/video_filter/deinterlace/yadif.h
+++ b/modules/video_filter/deinterlace/yadif.h
@@ -39,7 +39,7 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
 
 
 #ifdef CAN_COMPILE_SSSE3
-#if defined(__SSE__) || VLC_GCC_VERSION(4, 4)
+#if defined(__SSE__) || VLC_GCC_VERSION(4, 4) || defined(__clang__)
 // ================ SSSE3 =================
 #define HAVE_YADIF_SSSE3
 #define COMPILE_TEMPLATE_SSE 1
@@ -55,7 +55,7 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
 #endif
 
 #ifdef CAN_COMPILE_SSE2
-#if defined(__SSE__) || VLC_GCC_VERSION(4, 4)
+#if defined(__SSE__) || VLC_GCC_VERSION(4, 4) || defined(__clang__)
 // ================= SSE2 =================
 #define HAVE_YADIF_SSE2
 #define COMPILE_TEMPLATE_SSE 1
@@ -69,7 +69,7 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
 #endif
 
 #ifdef CAN_COMPILE_MMX
-#if defined(__MMX__) || VLC_GCC_VERSION(4, 4)
+#if defined(__MMX__) || VLC_GCC_VERSION(4, 4) || defined(__clang__)
 // ================ MMX =================
 #define HAVE_YADIF_MMX
 #define VLC_TARGET VLC_MMX


More information about the vlc-devel mailing list