From f443975599b46b007cd526dc455ad8ac7557efa8 Mon Sep 17 00:00:00 2001 From: Ingmar Steen Date: Sat, 25 Aug 2012 14:03:50 +0200 Subject: Fix compilation of par2 with clang. clang doesn't handle flexible arrays of non-POD types. So instead of a flexible array, use a 0-length array. Closes #14448. Signed-off-by: Max Howell Added comment for the Gentoo patch--- Library/Formula/par2.rb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Library/Formula/par2.rb b/Library/Formula/par2.rb index e2ee8d2b2..aae7e8f2a 100644 --- a/Library/Formula/par2.rb +++ b/Library/Formula/par2.rb @@ -9,12 +9,12 @@ class Par2 < Formula :because => "par2 and par2tbb install the same binaries." def patches - "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/par2cmdline/files/par2cmdline-0.4-gcc4.patch?revision=1.1" - end - - fails_with :clang do - build 318 - cause "./par2fileformat.h:87:25: error: flexible array member 'entries' of non-POD element type 'FILEVERIFICATIONENTRY []'" + [ + # Fixes compilation with GCC 4 and still required for clang + "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/par2cmdline/files/par2cmdline-0.4-gcc4.patch?revision=1.1", + # Clang doesn't like variable length arrays of non-POD types. + DATA + ] end def install @@ -23,3 +23,18 @@ class Par2 < Formula system "make install" end end + +__END__ +diff --git a/par2fileformat.h b/par2fileformat.h +index 9920b24..248cfaf 100644 +--- a/par2fileformat.h ++++ b/par2fileformat.h +@@ -84,7 +84,7 @@ struct FILEVERIFICATIONPACKET + PACKET_HEADER header; + // Body + MD5Hash fileid; // MD5hash of file_hash_16k, file_length, file_name +- FILEVERIFICATIONENTRY entries[]; ++ FILEVERIFICATIONENTRY entries[0]; + } PACKED; + + // The file description packet is used to record the name of the file, -- cgit v1.2.3