From e0f2e922a4367de5dca90e451e0183e312b71181 Mon Sep 17 00:00:00 2001 From: David Terei Date: Wed, 30 Jan 2013 19:46:39 -0800 Subject: [PATCH] Fix compilation on OSX. --- AdaptiveSampler.h | 1 + LogHistogramSampler.h | 6 ++++-- SConstruct | 6 +++++- mutilate.cc | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/AdaptiveSampler.h b/AdaptiveSampler.h index df9c2d4..e6efbc5 100644 --- a/AdaptiveSampler.h +++ b/AdaptiveSampler.h @@ -11,6 +11,7 @@ // under-represented). #include +#include #include #include #include diff --git a/LogHistogramSampler.h b/LogHistogramSampler.h index 7f218a4..44fada3 100644 --- a/LogHistogramSampler.h +++ b/LogHistogramSampler.h @@ -2,9 +2,10 @@ #ifndef LOGHISTOGRAMSAMPLER_H #define LOGHISTOGRAMSAMPLER_H -#include - #include +#include +#include + #include #include "Operation.h" @@ -53,6 +54,7 @@ public: double minimum() { for (size_t i = 0; i < bins.size(); i++) if (bins[i] > 0) return pow(_POW, (double) i + 0.5); + DIE("Not implemented"); } double get_nth(double nth) { diff --git a/SConstruct b/SConstruct index c148d52..e8a5b8e 100644 --- a/SConstruct +++ b/SConstruct @@ -1,5 +1,6 @@ #!/usr/bin/python import os +import sys 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(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.Define("__STDC_FORMAT_MACROS") diff --git a/mutilate.cc b/mutilate.cc index 98fe0cf..042fb55 100644 --- a/mutilate.cc +++ b/mutilate.cc @@ -511,7 +511,11 @@ void go(const vector& servers, options_t& options, if (options.threads > 1) { pthread_t pt[options.threads]; struct thread_data td[options.threads]; +#ifdef __clang__ + vector* ts = static_cast*>(alloca(sizeof(vector) * options.threads)); +#else vector ts[options.threads]; +#endif for (int t = 0; t < options.threads; t++) { td[t].options = &options;