@@ -1,3 +1,7 @@
1+Derivied from a patch distributed with the Homebrew formula:
2+https://github.com/Homebrew/homebrew-core/blob/6ae11ea82c00dc8c11297ecc3f06bc33979862d8/Formula/bonnie++.rb
3+
4+
15Copyright 2009-2016 Homebrew contributors.
26
37Redistribution and use in source and binary forms, with or without
@@ -23,52 +27,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2327
2428
2529# Changes included in this patchset:
26−# 1) Explicitly use clang/clang++ in Makefile
27−# 2) __min() and __max() macros break bon_csv2html.cpp: "redefinition of 'min' as different kind of symbol"
28−# Remove the construct in favor of macro targets min()/max() provided by the library
29−# Files affected: port.h.in port.h duration.cpp bonnie++.cpp
3030# 3) Remove the #ifdef _LARGEFILE64_SOURCE macros which not only prohibits the intended functionality of
3131# splitting into 2 GB files for such filesystems but also incorrectly tests for it in the first place.
3232# The ideal fix would be to replace the AC_TRY_RUN() in configure.in if the fail code actually worked.
3333# Files affected: bonnie++.cp
3434
35−diff --git i/Makefile w/Makefile
36−index 4bb5103..8f7ed41 100644
37−--- i/Makefile
38−+++ w/Makefile
39−@@ -10,8 +10,8 @@ eprefix=${prefix}
40− #MORE_WARNINGS=-Weffc++
41− WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS)
42− CFLAGS=-O2 -DNDEBUG $(WFLAGS) $(MORECFLAGS)
43−-CXX=g++ $(CFLAGS)
44−-LINK=g++
45−+CXX=clang++ $(CFLAGS)
46−+LINK=clang++
47− THREAD_LFLAGS=-lpthread
48−
49− INSTALL=/usr/bin/install -c
5035diff --git i/bonnie++.cpp w/bonnie++.cpp
5136index 8c5a43a..8a4b3dc 100644
5237--- i/bonnie++.cpp
5338+++ w/bonnie++.cpp
54−@@ -73,7 +73,7 @@ public:
55− void set_io_chunk_size(int size)
56− { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
57− void set_file_chunk_size(int size)
58−- { delete m_buf; m_buf = new char[__max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
59−+ { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
60−
61− // Return the page-aligned version of the local buffer
62− char *buf() { return m_buf_pa; }
63−@@ -138,7 +138,7 @@ CGlobalItems::CGlobalItems(bool *exitFlag)
64− , m_buf(NULL)
65− , m_buf_pa(NULL)
66− {
67−- pa_new(__max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
68−+ pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
69− SetName(".");
70− }
71−
7239@@ -294,11 +294,7 @@ int main(int argc, char *argv[])
7340 {
7441 char *sbuf = _strdup(optarg);
@@ -81,7 +48,7 @@ index 8c5a43a..8a4b3dc 100644
8148 size = strtok(NULL, "");
8249 if(size)
8350 {
84−@@ -384,17 +380,8 @@ int main(int argc, char *argv[])
51+@@ -384,15 +380,6 @@ int main(int argc, char *argv[])
8552 if(file_size % 1024 > 512)
8653 file_size = file_size + 1024 - (file_size % 1024);
8754 }
@@ -94,13 +61,9 @@ index 8c5a43a..8a4b3dc 100644
9461- usage();
9562- }
9663-#endif
97−- globals.byte_io_size = __min(file_size, globals.byte_io_size);
98−- globals.byte_io_size = __max(0, globals.byte_io_size);
99−+ globals.byte_io_size = min(file_size, globals.byte_io_size);
100−+ globals.byte_io_size = max(0, globals.byte_io_size);
64+ globals.byte_io_size = min(file_size, globals.byte_io_size);
65+ globals.byte_io_size = max(0, globals.byte_io_size);
10166
102− if(machine == NULL)
103− {
10467@@ -465,14 +452,6 @@ int main(int argc, char *argv[])
10568 && (directory_max_size < directory_min_size || directory_max_size < 0
10669 || directory_min_size < 0) )
@@ -116,42 +79,3 @@ index 8c5a43a..8a4b3dc 100644
11679 if(file_size && globals.ram && (file_size * concurrency) < (globals.ram * 2) )
11780 {
11881 fprintf(stderr
119−diff --git i/duration.cpp w/duration.cpp
120−index efa3fd3..f943155 100644
121−--- i/duration.cpp
122−+++ w/duration.cpp
123−@@ -38,7 +38,7 @@ double Duration_Base::stop()
124− getTime(&tv);
125− double ret;
126− ret = tv - m_start;
127−- m_max = __max(m_max, ret);
128−+ m_max = max(m_max, ret);
129− return ret;
130− }
131−
132−diff --git i/port.h w/port.h
133−index 8d53622..2e1f112 100644
134−--- i/port.h
135−+++ w/port.h
136−@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
137− #endif
138−
139− typedef int FILE_TYPE;
140−-#define __min min
141−-#define __max max
142− typedef unsigned int UINT;
143− typedef unsigned long ULONG;
144− typedef const char * PCCHAR;
145−diff --git i/port.h.in w/port.h.in
146−index 69c8f24..8359d72 100644
147−--- i/port.h.in
148−+++ w/port.h.in
149−@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
150− #endif
151−
152− typedef int FILE_TYPE;
153−-#define __min min
154−-#define __max max
155− typedef unsigned int UINT;
156− typedef unsigned long ULONG;
157− typedef const char * PCCHAR;