Commit cd3374d4 authored by Kenton Varda's avatar Kenton Varda

More clang updates.

parent 7c4b96b5
...@@ -2,27 +2,28 @@ ...@@ -2,27 +2,28 @@
EKAM=`which ekam || echo .ekam/bin/ekam` EKAM=`which ekam || echo .ekam/bin/ekam`
ifeq ($(CXX),clang++)
# Clang's verbose diagnostics don't play nice with the Ekam Eclipse plugin's error parsing,
# so disable them.
EXTRA_FLAG=-fno-caret-diagnostics
else
EXTRA_FLAG=
endif
all: all:
echo "You probably accidentally told Eclipse to build. Stopping." echo "You probably accidentally told Eclipse to build. Stopping."
once: once:
CXX=g++-4.7 CXXFLAGS='-std=gnu++0x -O2 -DNDEBUG -Wall' LIBS='-lz -pthread' $(EKAM) -j6 CXXFLAGS="$(EXTRA_FLAG) -std=c++11 -O2 -DNDEBUG -Wall" LIBS='-lz -pthread' $(EKAM) -j6
continuous: continuous:
CXX=g++-4.7 CXXFLAGS='-std=gnu++0x -g -Wall' LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315 CXXFLAGS="$(EXTRA_FLAG) -std=c++11 -g -Wall" LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315
continuous-opt: continuous-opt:
CXX=g++-4.7 CXXFLAGS='-std=gnu++0x -O2 -DNDEBUG -Wall' LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315 CXXFLAGS="$(EXTRA_FLAG) -std=c++11 -O2 -DNDEBUG -Wall" LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315
continuous-opt3: continuous-opt3:
CXX=g++-4.7 CXXFLAGS='-std=gnu++0x -O3 -DNDEBUG -Wall' LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315 CXXFLAGS="$(EXTRA_FLAG) -std=c++11 -O3 -DNDEBUG -Wall" LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315
continuous-clang:
CXX=clang++ CXXFLAGS='-fno-caret-diagnostics -std=c++1y -g -Wall' LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315
continuous-clang-opt:
CXX=clang++ CXXFLAGS='-fno-caret-diagnostics -std=c++11 -O2 -DNDEBUG -Wall' LIBS='-lz -pthread' $(EKAM) -j6 -c -n :51315
clean: clean:
rm -rf bin lib tmp rm -rf bin lib tmp
...@@ -25,7 +25,7 @@ AC_PROG_CC ...@@ -25,7 +25,7 @@ AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_RANLIB AC_PROG_RANLIB
AC_LANG([C++]) AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11 AX_CXX_COMPILE_STDCXX_11([noext])
ACX_PTHREAD ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS" LIBS="$PTHREAD_LIBS $LIBS"
......
...@@ -519,6 +519,8 @@ int main(int argc, char* argv[]) { ...@@ -519,6 +519,8 @@ int main(int argc, char* argv[]) {
size_t protobufObjSize = fileSize(std::string(testCaseName(testCase)) + ".pb.o"); size_t protobufObjSize = fileSize(std::string(testCaseName(testCase)) + ".pb.o");
size_t capnpObjSize = fileSize(std::string(testCaseName(testCase)) + ".capnp.o"); size_t capnpObjSize = fileSize(std::string(testCaseName(testCase)) + ".capnp.o");
TestResult oldNullCase;
TestResult oldNullCaseNoReuse;
TestResult oldCapnpBase; TestResult oldCapnpBase;
TestResult oldCapnpNoReuse; TestResult oldCapnpNoReuse;
TestResult oldCapnp; TestResult oldCapnp;
...@@ -535,6 +537,11 @@ int main(int argc, char* argv[]) { ...@@ -535,6 +537,11 @@ int main(int argc, char* argv[]) {
perror(oldDir); perror(oldDir);
return 1; return 1;
} }
oldNullCase = runTest(
Product::NULLCASE, testCase, Mode::OBJECT_SIZE, Reuse::YES, compression, iters);
reportResults("Old theoretical best pass-by-object", iters, nullCase);
oldCapnpBase = runTest( oldCapnpBase = runTest(
Product::CAPNPROTO, testCase, Mode::OBJECTS, Reuse::YES, compression, iters); Product::CAPNPROTO, testCase, Mode::OBJECTS, Reuse::YES, compression, iters);
oldCapnpBase.objectSize = runTest( oldCapnpBase.objectSize = runTest(
...@@ -542,6 +549,10 @@ int main(int argc, char* argv[]) { ...@@ -542,6 +549,10 @@ int main(int argc, char* argv[]) {
.objectSize; .objectSize;
reportResults("Old Cap'n Proto pass-by-object", iters, oldCapnpBase); reportResults("Old Cap'n Proto pass-by-object", iters, oldCapnpBase);
oldNullCaseNoReuse = runTest(
Product::NULLCASE, testCase, Mode::OBJECT_SIZE, Reuse::NO, compression, iters);
reportResults("Old theoretical best w/o object reuse", iters, oldNullCaseNoReuse);
oldCapnpNoReuse = runTest( oldCapnpNoReuse = runTest(
Product::CAPNPROTO, testCase, Mode::OBJECTS, Reuse::NO, compression, iters); Product::CAPNPROTO, testCase, Mode::OBJECTS, Reuse::NO, compression, iters);
oldCapnpNoReuse.objectSize = runTest( oldCapnpNoReuse.objectSize = runTest(
...@@ -599,15 +610,15 @@ int main(int argc, char* argv[]) { ...@@ -599,15 +610,15 @@ int main(int argc, char* argv[]) {
reportOldNewComparisonHeader(); reportOldNewComparisonHeader();
reportComparison("memory overhead", reportComparison("memory overhead",
nullCase.objectSize, oldCapnpBase.objectSize, capnpBase.objectSize, iters); oldNullCase.objectSize, oldCapnpBase.objectSize, capnpBase.objectSize, iters);
reportComparison("memory overhead w/o object reuse", reportComparison("memory overhead w/o object reuse",
nullCaseNoReuse.objectSize, oldCapnpNoReuse.objectSize, capnpNoReuse.objectSize, iters); oldNullCaseNoReuse.objectSize, oldCapnpNoReuse.objectSize, capnpNoReuse.objectSize, iters);
reportComparison("object manipulation time (us)", "", reportComparison("object manipulation time (us)", "",
((int64_t)oldCapnpBase.time.user - (int64_t)nullCase.time.user) / 1000.0, ((int64_t)oldCapnpBase.time.user - (int64_t)oldNullCase.time.user) / 1000.0,
((int64_t)capnpBase.time.user - (int64_t)nullCase.time.user) / 1000.0, iters); ((int64_t)capnpBase.time.user - (int64_t)oldNullCase.time.user) / 1000.0, iters);
reportComparison("object manipulation time w/o reuse (us)", "", reportComparison("object manipulation time w/o reuse (us)", "",
((int64_t)oldCapnpNoReuse.time.user - (int64_t)nullCaseNoReuse.time.user) / 1000.0, ((int64_t)oldCapnpNoReuse.time.user - (int64_t)oldNullCaseNoReuse.time.user) / 1000.0,
((int64_t)capnpNoReuse.time.user - (int64_t)nullCaseNoReuse.time.user) / 1000.0, iters); ((int64_t)capnpNoReuse.time.user - (int64_t)oldNullCaseNoReuse.time.user) / 1000.0, iters);
reportComparison("I/O time (us)", "", reportComparison("I/O time (us)", "",
((int64_t)oldCapnp.time.user - (int64_t)oldCapnpBase.time.user) / 1000.0, ((int64_t)oldCapnp.time.user - (int64_t)oldCapnpBase.time.user) / 1000.0,
((int64_t)capnp.time.user - (int64_t)capnpBase.time.user) / 1000.0, iters); ((int64_t)capnp.time.user - (int64_t)capnpBase.time.user) / 1000.0, iters);
......
...@@ -123,8 +123,10 @@ void printAddressBook(int fd) { ...@@ -123,8 +123,10 @@ void printAddressBook(int fd) {
## C++ Feature Usage: C++11, Exceptions ## C++ Feature Usage: C++11, Exceptions
This implementation makes use of C++11 features. If you are using GCC, you will need at least This implementation makes use of C++11 features. If you are using GCC, you will need at least
version 4.7 to compile Cap'n Proto, with `--std=gnu++0x`. Other compilers have not been tested at version 4.7 to compile Cap'n Proto. If you are using Clang, you will need at least version 3.2.
this time. These compilers required the flag `-std=c++11` to enable C++11 features -- your code which
`#include`s Cap'n Proto headers will need to be compiled with this flag. Other compilers have not
been tested at this time.
This implementation prefers to handle errors using exceptions. Exceptions are only used in This implementation prefers to handle errors using exceptions. Exceptions are only used in
circumstances that should never occur in normal operation. For example, exceptions are thrown circumstances that should never occur in normal operation. For example, exceptions are thrown
......
...@@ -51,10 +51,12 @@ attempt to build the C++ runtime. ...@@ -51,10 +51,12 @@ attempt to build the C++ runtime.
## Installing the C++ Runtime ## Installing the C++ Runtime
### GCC 4.7 Needed ### GCC 4.7 or Clang 3.2 Needed
If you are using GCC, you MUST use at least version 4.7 as Cap'n Proto uses recently-implemented If you are using GCC, you MUST use at least version 4.7 as Cap'n Proto uses recently-implemented
C++11 features. If you are using some other compiler... good luck. C++11 features. If you are using Clang, you must use at least version 3.2. To use Clang, set
the environment variable `CXX=clang++` before following any instructions below, otherwise `g++` is
used by default.
### Building with Ekam ### Building with Ekam
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment