Merge pull request #1 from dterei/master

Fix compilation on OSX.
This commit is contained in:
leverich 2013-02-02 17:52:53 -08:00
commit 973ef24eca
4 changed files with 14 additions and 3 deletions

View File

@ -11,6 +11,7 @@
// under-represented). // under-represented).
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -2,9 +2,10 @@
#ifndef LOGHISTOGRAMSAMPLER_H #ifndef LOGHISTOGRAMSAMPLER_H
#define LOGHISTOGRAMSAMPLER_H #define LOGHISTOGRAMSAMPLER_H
#include <inttypes.h>
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <vector> #include <vector>
#include "Operation.h" #include "Operation.h"
@ -53,6 +54,7 @@ public:
double minimum() { double minimum() {
for (size_t i = 0; i < bins.size(); i++) for (size_t i = 0; i < bins.size(); i++)
if (bins[i] > 0) return pow(_POW, (double) i + 0.5); if (bins[i] > 0) return pow(_POW, (double) i + 0.5);
DIE("Not implemented");
} }
double get_nth(double nth) { double get_nth(double nth) {

View File

@ -1,5 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import os import os
import sys
env = Environment(ENV = os.environ) env = Environment(ENV = os.environ)
@ -7,7 +8,10 @@ env['HAVE_POSIX_BARRIER'] = True
env.Append(CPPPATH = ['/usr/local/include', '/opt/local/include']) env.Append(CPPPATH = ['/usr/local/include', '/opt/local/include'])
env.Append(LIBPATH = ['/opt/local/lib']) env.Append(LIBPATH = ['/opt/local/lib'])
env.Append(CCFLAGS = '-std=c++0x -D_GNU_SOURCE') # -D__STDC_FORMAT_MACROS') env.Append(CCFLAGS = '-std=c++0x -D_GNU_SOURCE') # -D__STDC_FORMAT_MACROS')
if sys.platform == 'darwin':
env['CC'] = 'clang'
env['CXX'] = 'clang++'
conf = env.Configure(config_h = "config.h") conf = env.Configure(config_h = "config.h")
conf.Define("__STDC_FORMAT_MACROS") conf.Define("__STDC_FORMAT_MACROS")

View File

@ -511,7 +511,11 @@ void go(const vector<string>& servers, options_t& options,
if (options.threads > 1) { if (options.threads > 1) {
pthread_t pt[options.threads]; pthread_t pt[options.threads];
struct thread_data td[options.threads]; struct thread_data td[options.threads];
#ifdef __clang__
vector<string>* ts = static_cast<vector<string>*>(alloca(sizeof(vector<string>) * options.threads));
#else
vector<string> ts[options.threads]; vector<string> ts[options.threads];
#endif
for (int t = 0; t < options.threads; t++) { for (int t = 0; t < options.threads; t++) {
td[t].options = &options; td[t].options = &options;