aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngmar Steen2012-08-25 14:03:50 +0200
committerMax Howell2012-09-01 11:03:01 -0400
commitf443975599b46b007cd526dc455ad8ac7557efa8 (patch)
tree018b14a4bfd625b708b2b95a63c9c10dc3168b7b
parentc25abd748bff7f2ea3b6431012b4f8d6aefc493b (diff)
downloadhomebrew-f443975599b46b007cd526dc455ad8ac7557efa8.tar.bz2
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 <mxcl@me.com> Added comment for the Gentoo patch
-rw-r--r--Library/Formula/par2.rb27
1 files 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,