Skip to content

Commit

Permalink
Sync upb (#6577)
Browse files Browse the repository at this point in the history
* Sync upb

* protocolbuffers/upb#208

* Fix php c extension compiling

Don't use macros defined by upb

* Update ruby conformance failure list
  • Loading branch information
TeBoring committed Aug 27, 2019
1 parent b273cba commit 659e799
Show file tree
Hide file tree
Showing 6 changed files with 6,528 additions and 6,950 deletions.
2 changes: 0 additions & 2 deletions conformance/failure_list_ruby.txt
Expand Up @@ -102,8 +102,6 @@ Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
Required.Proto3.JsonInput.RejectTopLevelNull
Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput
Expand Down
12 changes: 6 additions & 6 deletions php/ext/google/protobuf/encode_decode.c
Expand Up @@ -47,8 +47,8 @@ size_t stringsink_string(void *_sink, const void *hd, const char *ptr,
stringsink *sink = _sink;
size_t new_size = sink->size;

UPB_UNUSED(hd);
UPB_UNUSED(handle);
PHP_PROTO_UNUSED(hd);
PHP_PROTO_UNUSED(handle);

while (sink->len + len > new_size) {
new_size *= 2;
Expand Down Expand Up @@ -243,7 +243,7 @@ DEFINE_APPEND_HANDLER(double, double)
static void* appendstr_handler(void *closure,
const void *hd,
size_t size_hint) {
UPB_UNUSED(hd);
PHP_PROTO_UNUSED(hd);

stringfields_parseframe_t* frame =
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
Expand Down Expand Up @@ -354,7 +354,7 @@ static void new_php_string(zval* value_ptr, const char* str, size_t len) {
static void* str_handler(void *closure,
const void *hd,
size_t size_hint) {
UPB_UNUSED(hd);
PHP_PROTO_UNUSED(hd);

stringfields_parseframe_t* frame =
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
Expand Down Expand Up @@ -763,7 +763,7 @@ static bool oneofstr_end_handler(void *closure, const void *hd) {
static void *oneofstr_handler(void *closure,
const void *hd,
size_t size_hint) {
UPB_UNUSED(hd);
PHP_PROTO_UNUSED(hd);

stringfields_parseframe_t* frame =
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
Expand Down Expand Up @@ -1093,7 +1093,7 @@ static void putmap(zval* map, const upb_fielddef* f, upb_sink sink,
static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) {
upb_selector_t ret;
bool ok = upb_handlers_getselector(f, type, &ret);
UPB_ASSERT(ok);
PHP_PROTO_ASSERT(ok);
return ret;
}

Expand Down
9 changes: 9 additions & 0 deletions php/ext/google/protobuf/protobuf.h
Expand Up @@ -46,6 +46,15 @@
#define ARRAY_SIZE(x) \
((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))

#define PHP_PROTO_UNUSED(var) (void)var
/* PHP_PROTO_ASSERT(): in release mode, we use the expression without letting
* it be evaluated. This prevents "unused variable" warnings. */
#ifdef NDEBUG
#define PHP_PROTO_ASSERT(expr) do {} while (false && (expr))
#else
#define PHP_PROTO_ASSERT(expr) assert(expr)
#endif

// -----------------------------------------------------------------------------
// PHP7 Wrappers
// ----------------------------------------------------------------------------
Expand Down

0 comments on commit 659e799

Please sign in to comment.