blob: 6be277d0c1cbb79d12d0a13c079839f2b9a566bf [file] [log] [blame]
diff -rup protobuf-3.4.0.orig/configure.ac protobuf-3.4.0/configure.ac
--- protobuf-3.4.0.orig/configure.ac 2017-09-17 16:34:26.000000000 -0700
+++ protobuf-3.4.0/configure.ac 2017-09-17 16:46:57.000000000 -0700
@@ -65,7 +65,6 @@ AC_LANG([C++])
ACX_USE_SYSTEM_EXTENSIONS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
-AC_PROG_OBJC
# test_util.cc takes forever to compile with GCC and optimization turned on.
AC_MSG_CHECKING([C++ compiler flags...])
@@ -189,15 +188,6 @@ case "$target_os" in
;;
esac
-# Enable ObjC support for conformance directory on OS X.
-OBJC_CONFORMANCE_TEST=0
-case "$target_os" in
- darwin*)
- OBJC_CONFORMANCE_TEST=1
- ;;
-esac
-AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1])
-
AX_CXX_COMPILE_STDCXX([11], [noext], [optional])
# HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS,
diff -rup protobuf-3.4.0.orig/conformance/Makefile.am protobuf-3.4.0/conformance/Makefile.am
--- protobuf-3.4.0.orig/conformance/Makefile.am 2017-09-17 16:34:26.000000000 -0700
+++ protobuf-3.4.0/conformance/Makefile.am 2017-09-17 16:48:31.000000000 -0700
@@ -24,8 +24,6 @@ protoc_outputs =
other_language_protoc_outputs = \
conformance_pb2.py \
- Conformance.pbobjc.h \
- Conformance.pbobjc.m \
conformance_pb.js \
conformance_pb.rb \
com/google/protobuf/Any.java \
@@ -225,24 +223,6 @@ conformance_cpp_CPPFLAGS = -I$(top_srcdi
# so a direct "make test_cpp" could fail if parallel enough.
conformance_cpp-conformance_cpp.$(OBJEXT): conformance.pb.h
-if OBJC_CONFORMANCE_TEST
-
-bin_PROGRAMS += conformance-objc
-
-conformance_objc_SOURCES = conformance_objc.m ../objectivec/GPBProtocolBuffers.m
-nodist_conformance_objc_SOURCES = Conformance.pbobjc.m google/protobuf/TestMessagesProto2.pbobjc.m google/protobuf/TestMessagesProto3.pbobjc.m
-# On travis, the build fails without the isysroot because whatever system
-# headers are being found don't include generics support for
-# NSArray/NSDictionary, the only guess is their image at one time had an odd
-# setup for Xcode and old frameworks are being found.
-conformance_objc_CPPFLAGS = -I$(top_srcdir)/objectivec -isysroot `xcrun --sdk macosx --show-sdk-path`
-conformance_objc_LDFLAGS = -framework Foundation
-# Explicit dep beacuse BUILT_SOURCES are only done before a "make all/check"
-# so a direct "make test_objc" could fail if parallel enough.
-conformance_objc-conformance_objc.$(OBJEXT): Conformance.pbobjc.h google/protobuf/TestMessagesProto2.pbobjc.h google/protobuf/TestMessagesProto3.pbobjc.h
-
-endif
-
# JavaScript well-known types are expected to be in a directory called
# google-protobuf, because they are usually in the google-protobuf npm
# package. But we want to use the sources from our tree, so we recreate
@@ -363,9 +343,3 @@ test_python_cpp: protoc_middleman confor
test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js
-if OBJC_CONFORMANCE_TEST
-
-test_objc: protoc_middleman conformance-test-runner conformance-objc
- ./conformance-test-runner --enforce_recommended --failure_list failure_list_objc.txt ./conformance-objc
-
-endif
diff -rup protobuf-3.4.0.orig/conformance/conformance_objc.m protobuf-3.4.0/conformance/conformance_objc.m
--- protobuf-3.4.0.orig/conformance/conformance_objc.m 2017-09-17 16:34:26.000000000 -0700
+++ protobuf-3.4.0/conformance/conformance_objc.m 2017-09-17 16:49:29.000000000 -0700
@@ -1,188 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2015 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#import <Foundation/Foundation.h>
-
-#import "Conformance.pbobjc.h"
-#import "google/protobuf/TestMessagesProto2.pbobjc.h"
-#import "google/protobuf/TestMessagesProto3.pbobjc.h"
-
-static void Die(NSString *format, ...) __dead2;
-
-static BOOL verbose = NO;
-static int32_t testCount = 0;
-
-static void Die(NSString *format, ...) {
- va_list args;
- va_start(args, format);
- NSString *msg = [[NSString alloc] initWithFormat:format arguments:args];
- NSLog(@"%@", msg);
- va_end(args);
- [msg release];
- exit(66);
-}
-
-static NSData *CheckedReadDataOfLength(NSFileHandle *handle, NSUInteger numBytes) {
- NSData *data = [handle readDataOfLength:numBytes];
- NSUInteger dataLen = data.length;
- if (dataLen == 0) {
- return nil; // EOF.
- }
- if (dataLen != numBytes) {
- Die(@"Failed to read the request length (%d), only got: %@",
- numBytes, data);
- }
- return data;
-}
-
-static ConformanceResponse *DoTest(ConformanceRequest *request) {
- ConformanceResponse *response = [ConformanceResponse message];
- GPBMessage *testMessage = nil;
-
- switch (request.payloadOneOfCase) {
- case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase:
- Die(@"Request didn't have a payload: %@", request);
- break;
-
- case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
- Class msgClass = nil;
- if ([request.messageType isEqual:@"protobuf_test_messages.proto3.TestAllTypesProto3"]) {
- msgClass = [Proto3TestAllTypesProto3 class];
- } else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
- msgClass = [TestAllTypesProto2 class];
- } else {
- Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
- }
- NSError *error = nil;
- testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
- if (!testMessage) {
- response.parseError =
- [NSString stringWithFormat:@"Parse error: %@", error];
- }
- break;
- }
-
- case ConformanceRequest_Payload_OneOfCase_JsonPayload:
- response.skipped = @"ObjC doesn't support parsing JSON";
- break;
- }
-
- if (testMessage) {
- switch (request.requestedOutputFormat) {
- case WireFormat_GPBUnrecognizedEnumeratorValue:
- case WireFormat_Unspecified:
- Die(@"Unrecognized/unspecified output format: %@", request);
- break;
-
- case WireFormat_Protobuf:
- response.protobufPayload = testMessage.data;
- if (!response.protobufPayload) {
- response.serializeError =
- [NSString stringWithFormat:@"Failed to make data from: %@", testMessage];
- }
- break;
-
- case WireFormat_Json:
- response.skipped = @"ObjC doesn't support generating JSON";
- break;
- }
- }
-
- return response;
-}
-
-static uint32_t UInt32FromLittleEndianData(NSData *data) {
- if (data.length != sizeof(uint32_t)) {
- Die(@"Data not the right size for uint32_t: %@", data);
- }
- uint32_t value;
- memcpy(&value, data.bytes, sizeof(uint32_t));
- return CFSwapInt32LittleToHost(value);
-}
-
-static NSData *UInt32ToLittleEndianData(uint32_t num) {
- uint32_t value = CFSwapInt32HostToLittle(num);
- return [NSData dataWithBytes:&value length:sizeof(uint32_t)];
-}
-
-static BOOL DoTestIo(NSFileHandle *input, NSFileHandle *output) {
- // See conformance_test_runner.cc for the wire format.
- NSData *data = CheckedReadDataOfLength(input, sizeof(uint32_t));
- if (!data) {
- // EOF.
- return NO;
- }
- uint32_t numBytes = UInt32FromLittleEndianData(data);
- data = CheckedReadDataOfLength(input, numBytes);
- if (!data) {
- Die(@"Failed to read request");
- }
-
- NSError *error = nil;
- ConformanceRequest *request = [ConformanceRequest parseFromData:data
- error:&error];
- if (!request) {
- Die(@"Failed to parse the message data: %@", error);
- }
-
- ConformanceResponse *response = DoTest(request);
- if (!response) {
- Die(@"Failed to make a reply from %@", request);
- }
-
- data = response.data;
- [output writeData:UInt32ToLittleEndianData((int32_t)data.length)];
- [output writeData:data];
-
- if (verbose) {
- NSLog(@"Request: %@", request);
- NSLog(@"Response: %@", response);
- }
-
- ++testCount;
- return YES;
-}
-
-int main(int argc, const char *argv[]) {
- @autoreleasepool {
- NSFileHandle *input = [[NSFileHandle fileHandleWithStandardInput] retain];
- NSFileHandle *output = [[NSFileHandle fileHandleWithStandardOutput] retain];
-
- BOOL notDone = YES;
- while (notDone) {
- @autoreleasepool {
- notDone = DoTestIo(input, output);
- }
- }
-
- NSLog(@"Received EOF from test runner after %d tests, exiting.", testCount);
- }
- return 0;
-}
diff -rup protobuf-3.4.0.orig/src/google/protobuf/io/zero_copy_stream_impl_lite.h protobuf-3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h
--- protobuf-3.4.0.orig/src/google/protobuf/io/zero_copy_stream_impl_lite.h 2017-09-17 16:34:27.000000000 -0700
+++ protobuf-3.4.0/src/google/protobuf/io/zero_copy_stream_impl_lite.h 2017-09-17 16:45:58.000000000 -0700
@@ -377,13 +377,9 @@ class LIBPROTOBUF_EXPORT CopyingOutputSt
// return value is valid until the next time the string is resized. We
// trust the caller to treat the return value as an array of length s->size().
inline char* mutable_string_data(string* s) {
-#ifdef LANG_CXX11
// This should be simpler & faster than string_as_array() because the latter
// is guaranteed to return NULL when *s is empty, so it has to check for that.
return &(*s)[0];
-#else
- return string_as_array(s);
-#endif
}
// as_string_data(s) is equivalent to
@@ -392,11 +388,7 @@ inline char* mutable_string_data(string*
// code can avoid that check.
inline std::pair<char*, bool> as_string_data(string* s) {
char *p = mutable_string_data(s);
-#ifdef LANG_CXX11
return std::make_pair(p, true);
-#else
- return std::make_pair(p, p != NULL);
-#endif
}
} // namespace io