Skip to content

Commit

Permalink
Merge pull request #8637 from dschopf/fix-qnx-7.0-support
Browse files Browse the repository at this point in the history
Fix QNX 7.0 support #8593
  • Loading branch information
fowles authored Jun 4, 2021
2 parents c05e7ad + bbccb31 commit 8d8ba6a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/cpp/cpp_enum_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void RepeatedEnumFieldGenerator::GenerateConstinitInitializer(
format("$name$_()");
if (descriptor_->is_packed() &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, _$name$_cached_byte_size_()");
format("\n, _$name$_cached_byte_size_(0)");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateConstinitInitializer(
format("$name$_()");
if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, _$name$_cached_byte_size_()");
format("\n, _$name$_cached_byte_size_(0)");
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/google/protobuf/descriptor.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/google/protobuf/io/coded_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@
#elif defined(__FreeBSD__)
#include <sys/endian.h> // __BYTE_ORDER
#else
#if !defined(__QNX__)
#include <endian.h> // __BYTE_ORDER
#endif
#endif
#if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
Expand Down
4 changes: 4 additions & 0 deletions src/google/protobuf/stubs/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ class CallOnceInitializedMutex {
// mutexes.
class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
public:
#if defined(__QNX__)
constexpr WrappedMutex() = default;
#else
constexpr WrappedMutex() {}
#endif
void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
// Crash if this Mutex is not held exclusively by this thread.
Expand Down
4 changes: 4 additions & 0 deletions src/google/protobuf/stubs/platform_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__QNX__)
#define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1
#if defined(__aarch64__)
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#else
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#endif
#elif defined(_M_ARM) || defined(__ARMEL__)
#define GOOGLE_PROTOBUF_ARCH_ARM 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
Expand Down
2 changes: 2 additions & 0 deletions src/google/protobuf/stubs/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@
#elif defined(__FreeBSD__)
#include <sys/endian.h> // __BYTE_ORDER
#else
#if !defined(__QNX__)
#include <endian.h> // __BYTE_ORDER
#endif
#endif
#if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \
(defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN)) && \
Expand Down

0 comments on commit 8d8ba6a

Please sign in to comment.