Skip to content

Commit 659e799

Browse files
authored
Sync upb (#6577)
* Sync upb * protocolbuffers/upb#208 * Fix php c extension compiling Don't use macros defined by upb * Update ruby conformance failure list
1 parent b273cba commit 659e799

File tree

6 files changed

+6528
-6950
lines changed

6 files changed

+6528
-6950
lines changed

conformance/failure_list_ruby.txt

-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
102102
Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
103103
Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
104104
Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
105-
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
106-
Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
107105
Required.Proto3.JsonInput.RejectTopLevelNull
108106
Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
109107
Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput

php/ext/google/protobuf/encode_decode.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ size_t stringsink_string(void *_sink, const void *hd, const char *ptr,
4747
stringsink *sink = _sink;
4848
size_t new_size = sink->size;
4949

50-
UPB_UNUSED(hd);
51-
UPB_UNUSED(handle);
50+
PHP_PROTO_UNUSED(hd);
51+
PHP_PROTO_UNUSED(handle);
5252

5353
while (sink->len + len > new_size) {
5454
new_size *= 2;
@@ -243,7 +243,7 @@ DEFINE_APPEND_HANDLER(double, double)
243243
static void* appendstr_handler(void *closure,
244244
const void *hd,
245245
size_t size_hint) {
246-
UPB_UNUSED(hd);
246+
PHP_PROTO_UNUSED(hd);
247247

248248
stringfields_parseframe_t* frame =
249249
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
@@ -354,7 +354,7 @@ static void new_php_string(zval* value_ptr, const char* str, size_t len) {
354354
static void* str_handler(void *closure,
355355
const void *hd,
356356
size_t size_hint) {
357-
UPB_UNUSED(hd);
357+
PHP_PROTO_UNUSED(hd);
358358

359359
stringfields_parseframe_t* frame =
360360
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
@@ -763,7 +763,7 @@ static bool oneofstr_end_handler(void *closure, const void *hd) {
763763
static void *oneofstr_handler(void *closure,
764764
const void *hd,
765765
size_t size_hint) {
766-
UPB_UNUSED(hd);
766+
PHP_PROTO_UNUSED(hd);
767767

768768
stringfields_parseframe_t* frame =
769769
(stringfields_parseframe_t*)malloc(sizeof(stringfields_parseframe_t));
@@ -1093,7 +1093,7 @@ static void putmap(zval* map, const upb_fielddef* f, upb_sink sink,
10931093
static upb_selector_t getsel(const upb_fielddef* f, upb_handlertype_t type) {
10941094
upb_selector_t ret;
10951095
bool ok = upb_handlers_getselector(f, type, &ret);
1096-
UPB_ASSERT(ok);
1096+
PHP_PROTO_ASSERT(ok);
10971097
return ret;
10981098
}
10991099

php/ext/google/protobuf/protobuf.h

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
#define ARRAY_SIZE(x) \
4747
((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
4848

49+
#define PHP_PROTO_UNUSED(var) (void)var
50+
/* PHP_PROTO_ASSERT(): in release mode, we use the expression without letting
51+
* it be evaluated. This prevents "unused variable" warnings. */
52+
#ifdef NDEBUG
53+
#define PHP_PROTO_ASSERT(expr) do {} while (false && (expr))
54+
#else
55+
#define PHP_PROTO_ASSERT(expr) assert(expr)
56+
#endif
57+
4958
// -----------------------------------------------------------------------------
5059
// PHP7 Wrappers
5160
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)