Commit f8e2aa18 authored by Kenton Varda's avatar Kenton Varda

Merge branch 'master' of https://github.com/kentonv/capnproto

parents c0750662 cbd65e2d
...@@ -154,8 +154,9 @@ includecapnp_HEADERS = \ ...@@ -154,8 +154,9 @@ includecapnp_HEADERS = \
lib_LTLIBRARIES = libkj.la libcapnp.la libcapnpc.la lib_LTLIBRARIES = libkj.la libcapnp.la libcapnpc.la
libkj_la_LIBADD = $(PTHREAD_LIBS) # -lpthread is here to work around https://bugzilla.redhat.com/show_bug.cgi?id=661333
libkj_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined libkj_la_LIBADD = $(PTHREAD_LIBS) -lpthread
libkj_la_LDFLAGS = -release $(VERSION) -Wl,--no-undefined
libkj_la_SOURCES= \ libkj_la_SOURCES= \
src/kj/common.c++ \ src/kj/common.c++ \
src/kj/units.c++ \ src/kj/units.c++ \
...@@ -172,8 +173,9 @@ libkj_la_SOURCES= \ ...@@ -172,8 +173,9 @@ libkj_la_SOURCES= \
src/kj/main.c++ \ src/kj/main.c++ \
src/kj/parse/char.c++ src/kj/parse/char.c++
libcapnp_la_LIBADD = libkj.la $(PTHREAD_LIBS) # -lpthread is here to work around https://bugzilla.redhat.com/show_bug.cgi?id=661333
libcapnp_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined libcapnp_la_LIBADD = libkj.la $(PTHREAD_LIBS) -lpthread
libcapnp_la_LDFLAGS = -release $(VERSION) -Wl,--no-undefined
libcapnp_la_SOURCES= \ libcapnp_la_SOURCES= \
src/capnp/c++.capnp.c++ \ src/capnp/c++.capnp.c++ \
src/capnp/blob.c++ \ src/capnp/blob.c++ \
...@@ -190,8 +192,9 @@ libcapnp_la_SOURCES= \ ...@@ -190,8 +192,9 @@ libcapnp_la_SOURCES= \
src/capnp/serialize.c++ \ src/capnp/serialize.c++ \
src/capnp/serialize-packed.c++ src/capnp/serialize-packed.c++
libcapnpc_la_LIBADD = libcapnp.la libkj.la $(PTHREAD_LIBS) # -lpthread is here to work around https://bugzilla.redhat.com/show_bug.cgi?id=661333
libcapnpc_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined libcapnpc_la_LIBADD = libcapnp.la libkj.la $(PTHREAD_LIBS) -lpthread
libcapnpc_la_LDFLAGS = -release $(VERSION) -Wl,--no-undefined
libcapnpc_la_SOURCES= \ libcapnpc_la_SOURCES= \
src/capnp/compiler/md5.h \ src/capnp/compiler/md5.h \
src/capnp/compiler/md5.c++ \ src/capnp/compiler/md5.c++ \
......
...@@ -48,6 +48,8 @@ AS_IF([test "$external_capnp" != "no"], [ ...@@ -48,6 +48,8 @@ AS_IF([test "$external_capnp" != "no"], [
]) ])
AM_CONDITIONAL([USE_EXTERNAL_CAPNP], [test "$external_capnp" != "no"]) AM_CONDITIONAL([USE_EXTERNAL_CAPNP], [test "$external_capnp" != "no"])
AC_SEARCH_LIBS(sched_yield, rt)
LIBS="$PTHREAD_LIBS $LIBS" LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
......
...@@ -31,30 +31,30 @@ fail() { ...@@ -31,30 +31,30 @@ fail() {
exit 1 exit 1
} }
if test -e ./capnp; then if test -f ./capnp; then
CAPNP=${CAPNP:-./capnp} CAPNP=${CAPNP:-./capnp}
else else
CAPNP=${CAPNP:-capnp} CAPNP=${CAPNP:-capnp}
fi fi
SCHEMA=$(dirname "$0")/../test.capnp SCHEMA=`dirname "$0"`/../test.capnp
TESTDATA=$(dirname "$0")/../testdata TESTDATA=`dirname "$0"`/../testdata
$CAPNP encode $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/binary || fail encode $CAPNP encode $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/binary - || fail encode
$CAPNP encode --flat $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/flat || fail encode flat $CAPNP encode --flat $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/flat - || fail encode flat
$CAPNP encode --packed $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/packed || fail encode packed $CAPNP encode --packed $SCHEMA TestAllTypes < $TESTDATA/short.txt | cmp $TESTDATA/packed - || fail encode packed
$CAPNP encode $SCHEMA TestAllTypes < $TESTDATA/pretty.txt | cmp $TESTDATA/binary || fail parse pretty $CAPNP encode $SCHEMA TestAllTypes < $TESTDATA/pretty.txt | cmp $TESTDATA/binary - || fail parse pretty
$CAPNP decode $SCHEMA TestAllTypes < $TESTDATA/binary | cmp $TESTDATA/pretty.txt || fail decode $CAPNP decode $SCHEMA TestAllTypes < $TESTDATA/binary | cmp $TESTDATA/pretty.txt - || fail decode
$CAPNP decode --flat $SCHEMA TestAllTypes < $TESTDATA/flat | cmp $TESTDATA/pretty.txt || fail decode flat $CAPNP decode --flat $SCHEMA TestAllTypes < $TESTDATA/flat | cmp $TESTDATA/pretty.txt - || fail decode flat
$CAPNP decode --packed $SCHEMA TestAllTypes < $TESTDATA/packed | cmp $TESTDATA/pretty.txt || fail decode packed $CAPNP decode --packed $SCHEMA TestAllTypes < $TESTDATA/packed | cmp $TESTDATA/pretty.txt - || fail decode packed
$CAPNP decode --short $SCHEMA TestAllTypes < $TESTDATA/binary | cmp $TESTDATA/short.txt || fail decode short $CAPNP decode --short $SCHEMA TestAllTypes < $TESTDATA/binary | cmp $TESTDATA/short.txt - || fail decode short
$CAPNP decode $SCHEMA TestAllTypes < $TESTDATA/segmented | cmp $TESTDATA/pretty.txt || fail decode segmented $CAPNP decode $SCHEMA TestAllTypes < $TESTDATA/segmented | cmp $TESTDATA/pretty.txt - || fail decode segmented
$CAPNP decode --packed $SCHEMA TestAllTypes < $TESTDATA/segmented-packed | cmp $TESTDATA/pretty.txt || fail decode segmented-packed $CAPNP decode --packed $SCHEMA TestAllTypes < $TESTDATA/segmented-packed | cmp $TESTDATA/pretty.txt - || fail decode segmented-packed
test_eval() { test_eval() {
test "x$($CAPNP eval $SCHEMA $1)" = "x$2" || fail eval "$1 == $2" test "x`$CAPNP eval $SCHEMA $1`" = "x$2" || fail eval "$1 == $2"
} }
test_eval TestDefaults.uInt32Field 3456789012 test_eval TestDefaults.uInt32Field 3456789012
...@@ -66,4 +66,4 @@ test_eval TestConstants.enumConst corge ...@@ -66,4 +66,4 @@ test_eval TestConstants.enumConst corge
test_eval 'TestListDefaults.lists.int32ListList[2][0]' 12341234 test_eval 'TestListDefaults.lists.int32ListList[2][0]' 12341234
$CAPNP compile -ofoo $TESTDATA/errors.capnp.nobuild 2>&1 | sed -e "s,^.*/errors[.]capnp[.]nobuild,file,g" | $CAPNP compile -ofoo $TESTDATA/errors.capnp.nobuild 2>&1 | sed -e "s,^.*/errors[.]capnp[.]nobuild,file,g" |
cmp $TESTDATA/errors.txt || fail error output cmp $TESTDATA/errors.txt - || fail error output
...@@ -241,7 +241,7 @@ private: ...@@ -241,7 +241,7 @@ private:
switch (value.which()) { switch (value.which()) {
case schema::Value::VOID: return kj::strTree(" ::capnp::VOID"); case schema::Value::VOID: return kj::strTree(" ::capnp::VOID");
case schema::Value::BOOL: return kj::strTree(value.getBool() ? "true" : "false"); case schema::Value::BOOL: return kj::strTree(value.getBool() ? "true" : "false");
case schema::Value::INT8: return kj::strTree(value.getInt8()); case schema::Value::INT8: return kj::strTree(int(value.getInt8()));
case schema::Value::INT16: return kj::strTree(value.getInt16()); case schema::Value::INT16: return kj::strTree(value.getInt16());
case schema::Value::INT32: return kj::strTree(value.getInt32()); case schema::Value::INT32: return kj::strTree(value.getInt32());
case schema::Value::INT64: return kj::strTree(value.getInt64(), "ll"); case schema::Value::INT64: return kj::strTree(value.getInt64(), "ll");
...@@ -652,6 +652,13 @@ private: ...@@ -652,6 +652,13 @@ private:
setterDefault = " = ::capnp::VOID"; setterDefault = " = ::capnp::VOID";
break; break;
case schema::Type::INT8:
kind = FieldKind::PRIMITIVE;
if (defaultBody.getInt8() != 0) {
defaultMask = kj::str(int(defaultBody.getInt8()), "");
}
break;
#define HANDLE_PRIMITIVE(discrim, typeName, defaultName, suffix) \ #define HANDLE_PRIMITIVE(discrim, typeName, defaultName, suffix) \
case schema::Type::discrim: \ case schema::Type::discrim: \
kind = FieldKind::PRIMITIVE; \ kind = FieldKind::PRIMITIVE; \
...@@ -661,7 +668,7 @@ private: ...@@ -661,7 +668,7 @@ private:
break; break;
HANDLE_PRIMITIVE(BOOL, bool, Bool, ); HANDLE_PRIMITIVE(BOOL, bool, Bool, );
HANDLE_PRIMITIVE(INT8 , ::int8_t , Int8 , ); //HANDLE_PRIMITIVE(INT8 , ::int8_t , Int8 , );
HANDLE_PRIMITIVE(INT16, ::int16_t, Int16, ); HANDLE_PRIMITIVE(INT16, ::int16_t, Int16, );
HANDLE_PRIMITIVE(INT32, ::int32_t, Int32, ); HANDLE_PRIMITIVE(INT32, ::int32_t, Int32, );
HANDLE_PRIMITIVE(INT64, ::int64_t, Int64, ll); HANDLE_PRIMITIVE(INT64, ::int64_t, Int64, ll);
......
...@@ -81,13 +81,13 @@ namespace compiler { ...@@ -81,13 +81,13 @@ namespace compiler {
SET(n) SET(n)
#else #else
#define SET(n) \ #define SET(n) \
(ctx->block[(n)] = \ (ctx.block[(n)] = \
(MD5_u32plus)ptr[(n) * 4] | \ (MD5_u32plus)ptr[(n) * 4] | \
((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
#define GET(n) \ #define GET(n) \
(ctx->block[(n)]) (ctx.block[(n)])
#endif #endif
/* /*
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <exception> #include <exception>
#ifndef __CYGWIN__ #if !defined(__CYGWIN__) && !defined(__sun)
#define KJ_HAS_BACKTRACE 1
#include <execinfo.h> #include <execinfo.h>
#endif #endif
...@@ -177,7 +178,7 @@ Exception::Exception(Nature nature, Durability durability, const char* file, int ...@@ -177,7 +178,7 @@ Exception::Exception(Nature nature, Durability durability, const char* file, int
String description) noexcept String description) noexcept
: file(file), line(line), nature(nature), durability(durability), : file(file), line(line), nature(nature), durability(durability),
description(mv(description)) { description(mv(description)) {
#ifdef __CYGWIN__ #ifndef KJ_HAS_BACKTRACE
traceCount = 0; traceCount = 0;
#else #else
traceCount = backtrace(trace, 16); traceCount = backtrace(trace, 16);
...@@ -188,7 +189,7 @@ Exception::Exception(Nature nature, Durability durability, String file, int line ...@@ -188,7 +189,7 @@ Exception::Exception(Nature nature, Durability durability, String file, int line
String description) noexcept String description) noexcept
: ownFile(kj::mv(file)), file(ownFile.cStr()), line(line), nature(nature), : ownFile(kj::mv(file)), file(ownFile.cStr()), line(line), nature(nature),
durability(durability), description(mv(description)) { durability(durability), description(mv(description)) {
#ifdef __CYGWIN__ #ifndef KJ_HAS_BACKTRACE
traceCount = 0; traceCount = 0;
#else #else
traceCount = backtrace(trace, 16); traceCount = backtrace(trace, 16);
......
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