summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--upb/def.c1
-rw-r--r--upb/google/bridge.cc2
-rw-r--r--upb/google/proto2.cc4
-rw-r--r--upb/handlers.h28
-rw-r--r--upb/pb/decoder.c1
-rw-r--r--upb/table.c4
7 files changed, 24 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index c5df799..787b2cd 100644
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,7 @@ CXX=g++
CFLAGS=-std=gnu99
CXXFLAGS=-Ibindings/cpp
INCLUDE=-Itests -I.
-CPPFLAGS=$(INCLUDE) -Wall -Wextra $(USER_CFLAGS)
+CPPFLAGS=$(INCLUDE) -Wall -Wextra -Wno-sign-compare $(USER_CFLAGS)
LDLIBS=-lpthread upb/libupb.a
LUA=lua5.1 # 5.1 and 5.2 should both be supported
@@ -82,7 +82,7 @@ deps: Makefile $(ALLSRC)
# The core library.
CORE= \
- upb/bytestream.c \
+ upb/bytestream.upb.c \
upb/def.c \
upb/descriptor/reader.c \
upb/descriptor/descriptor.upb.c \
@@ -101,9 +101,10 @@ CORE= \
PB= \
upb/pb/decoder.c \
upb/pb/glue.c \
- upb/pb/textprinter.c \
upb/pb/varint.c \
+ #upb/pb/textprinter.c \
+
# Rules. #######################################################################
@@ -247,7 +248,8 @@ $(SIMPLE_CXX_TESTS): % : %.cc
$(E) CXX $<
$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ tests/testmain.o $< $(LIBUPB)
-VALGRIND=valgrind --leak-check=full --error-exitcode=1
+#VALGRIND=valgrind --leak-check=full --error-exitcode=1 --track-origins=yes
+VALGRIND=
test: tests
@echo Running all tests under valgrind.
@set -e # Abort on error.
diff --git a/upb/def.c b/upb/def.c
index aad0e51..b8d3259 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -676,6 +676,7 @@ upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f) {
return upb_fielddef_istagdelim(f) ?
UPB_DESCRIPTOR_TYPE_GROUP : UPB_DESCRIPTOR_TYPE_MESSAGE;
}
+ return 0;
}
bool upb_fielddef_setlabel(upb_fielddef *f, upb_label_t label) {
diff --git a/upb/google/bridge.cc b/upb/google/bridge.cc
index f5b664c..93e5c27 100644
--- a/upb/google/bridge.cc
+++ b/upb/google/bridge.cc
@@ -208,7 +208,7 @@ static upb::MessageDef* NewMessageDef(const goog::Message& m, const void* owner,
// Must do this before processing submessages to prevent infinite recursion.
defs->AddMessage(&m, md);
- vector<const goog::FieldDescriptor*> fields;
+ std::vector<const goog::FieldDescriptor*> fields;
d->file()->pool()->FindAllExtensions(d, &fields);
for (int i = 0; i < d->field_count(); i++) {
fields.push_back(d->field(i));
diff --git a/upb/google/proto2.cc b/upb/google/proto2.cc
index d7ad919..8f9bcd8 100644
--- a/upb/google/proto2.cc
+++ b/upb/google/proto2.cc
@@ -409,7 +409,7 @@ case goog::FieldDescriptor::cpptype: \
static_cast<const EnumHandlerData*>(frame->handler_data());
if (data->IsValidValue(val)) {
goog::RepeatedField<int32_t>* r =
- data->GetFieldPointer<goog::RepeatedField<int32_t>>(m);
+ data->GetFieldPointer<goog::RepeatedField<int32_t> >(m);
r->Add(val);
} else {
data->mutable_unknown_fields(m)->AddVarint(data->field_number(), val);
@@ -487,7 +487,7 @@ case goog::FieldDescriptor::cpptype: \
} else {
StringHandlerData<T>* data = new StringHandlerData<T>(proto2_f, r);
h->SetStartStringHandler(f, &StartString<T>, data,
- &upb::DeletePointer<StringHandlerData<T>>);
+ &upb::DeletePointer<StringHandlerData<T> >);
}
}
diff --git a/upb/handlers.h b/upb/handlers.h
index 582ba43..79ca0d8 100644
--- a/upb/handlers.h
+++ b/upb/handlers.h
@@ -915,37 +915,37 @@ inline bool Handlers::SetUInt64Handler(
}
#endif
-#define SET_VALUE_HANDLER(type, ctype) \
+#define SET_VALUE_HANDLER(type, ctype, handlertype) \
template<> \
inline bool Handlers::SetValueHandler<ctype>( \
const FieldDef* f, \
- typename Handlers::Value<ctype>::Handler* handler, \
+ handlertype* handler, \
void* data, Handlers::Free* cleanup) { \
return upb_handlers_set ## type(this, f, handler, data, cleanup); \
} \
template<> \
inline bool Handlers::SetValueHandler<ctype>( \
const char* f, \
- typename Handlers::Value<ctype>::Handler* handler, \
+ handlertype* handler, \
void* data, Handlers::Free* cleanup) { \
return upb_handlers_set ## type ## _n(this, f, handler, data, cleanup); \
}
-SET_VALUE_HANDLER(double, double);
-SET_VALUE_HANDLER(float, float);
-SET_VALUE_HANDLER(uint64, upb_uint64_t);
-SET_VALUE_HANDLER(uint32, upb_uint32_t);
-SET_VALUE_HANDLER(int64, upb_int64_t);
-SET_VALUE_HANDLER(int32, upb_int32_t);
-SET_VALUE_HANDLER(bool, bool);
+SET_VALUE_HANDLER(double, double, DoubleHandler);
+SET_VALUE_HANDLER(float, float, FloatHandler);
+SET_VALUE_HANDLER(uint64, upb_uint64_t, UInt64Handler);
+SET_VALUE_HANDLER(uint32, upb_uint32_t, UInt32Handler);
+SET_VALUE_HANDLER(int64, upb_int64_t, Int64Handler);
+SET_VALUE_HANDLER(int32, upb_int32_t, Int32Handler);
+SET_VALUE_HANDLER(bool, bool, BoolHandler);
#ifdef UPB_TWO_32BIT_TYPES
-SET_VALUE_HANDLER(int32alt, upb_int32alt_t);
-SET_VALUE_HANDLER(uint32alt, upb_uint32alt_t);
+SET_VALUE_HANDLER(int32alt, upb_int32alt_t, Int32Handler2);
+SET_VALUE_HANDLER(uint32alt, upb_uint32alt_t, UInt32Handler2);
#endif
#ifdef UPB_TWO_64BIT_TYPES
-SET_VALUE_HANDLER(int64alt, upb_int64alt_t);
-SET_VALUE_HANDLER(uint64alt, upb_uint64alt_t);
+SET_VALUE_HANDLER(int64alt, upb_int64alt_t, Int64Handler2);
+SET_VALUE_HANDLER(uint64alt, upb_uint64alt_t, UInt64Handler2);
#endif
#undef SET_VALUE_HANDLER
diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c
index 2bfc717..da4c48d 100644
--- a/upb/pb/decoder.c
+++ b/upb/pb/decoder.c
@@ -290,7 +290,6 @@ static void suspendjmp(upb_pbdecoder *d) {
}
static void advancetobuf(upb_pbdecoder *d, const char *buf, size_t len) {
- assert(len >= 0);
assert(d->ptr == d->end);
d->bufstart_ofs += (d->ptr - d->buf);
switchtobuf(d, buf, buf + len);
diff --git a/upb/table.c b/upb/table.c
index a54e715..40f841d 100644
--- a/upb/table.c
+++ b/upb/table.c
@@ -22,12 +22,8 @@ static const double MAX_LOAD = 0.85;
static const double MIN_DENSITY = 0.1;
int upb_log2(uint64_t v) {
-#ifdef __GNUC__
- int ret = 31 - __builtin_clz(v);
-#else
int ret = 0;
while (v >>= 1) ret++;
-#endif
return UPB_MIN(UPB_MAXARRSIZE, ret);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback