diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-05-26 11:10:00 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-05-26 11:10:00 -0400 |
commit | 0f27cab4fb378b94a91c2b1522174ec21719df9d (patch) | |
tree | 6111cbd70b21027c678647381eba6d3974b51740 /objectivec/GPBDescriptor_PackagePrivate.h | |
parent | ed87c1fe2c6e1633cadb62cf54b2723b2b25c280 (diff) | |
parent | c8a440dfb68074ff310e624928cd2dd61c101728 (diff) | |
download | protobuf-0f27cab4fb378b94a91c2b1522174ec21719df9d.tar.gz protobuf-0f27cab4fb378b94a91c2b1522174ec21719df9d.tar.bz2 protobuf-0f27cab4fb378b94a91c2b1522174ec21719df9d.zip |
Merge pull request #1600 from thomasvl/objc_tighter_warnings
Add more warnings to for the ObjC runtime build
Diffstat (limited to 'objectivec/GPBDescriptor_PackagePrivate.h')
-rw-r--r-- | objectivec/GPBDescriptor_PackagePrivate.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/objectivec/GPBDescriptor_PackagePrivate.h b/objectivec/GPBDescriptor_PackagePrivate.h index e3d0a80f..c20ff6b0 100644 --- a/objectivec/GPBDescriptor_PackagePrivate.h +++ b/objectivec/GPBDescriptor_PackagePrivate.h @@ -245,6 +245,12 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) { CF_EXTERN_C_BEGIN +// Direct access is use for speed, to avoid even internally declaring things +// read/write, etc. The warning is enabled in the project to ensure code calling +// protos can turn on -Wdirect-ivar-access without issues. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdirect-ivar-access" + GPB_INLINE BOOL GPBFieldIsMapOrArray(GPBFieldDescriptor *field) { return (field->description_->flags & (GPBFieldRepeated | GPBFieldMapKeyMask)) != 0; @@ -262,6 +268,8 @@ GPB_INLINE uint32_t GPBFieldNumber(GPBFieldDescriptor *field) { return field->description_->number; } +#pragma clang diagnostic pop + uint32_t GPBFieldTag(GPBFieldDescriptor *self); // For repeated fields, alternateWireType is the wireType with the opposite @@ -291,23 +299,23 @@ GPB_INLINE BOOL GPBExtensionIsWireFormat(GPBExtensionDescription *description) { } // Helper for compile time assets. -#ifndef _GPBCompileAssert +#ifndef GPBInternalCompileAssert #if __has_feature(c_static_assert) || __has_extension(c_static_assert) - #define _GPBCompileAssert(test, msg) _Static_assert((test), #msg) + #define GPBInternalCompileAssert(test, msg) _Static_assert((test), #msg) #else // Pre-Xcode 7 support. - #define _GPBCompileAssertSymbolInner(line, msg) _GPBCompileAssert ## line ## __ ## msg - #define _GPBCompileAssertSymbol(line, msg) _GPBCompileAssertSymbolInner(line, msg) - #define _GPBCompileAssert(test, msg) \ - typedef char _GPBCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ] + #define GPBInternalCompileAssertSymbolInner(line, msg) GPBInternalCompileAssert ## line ## __ ## msg + #define GPBInternalCompileAssertSymbol(line, msg) GPBInternalCompileAssertSymbolInner(line, msg) + #define GPBInternalCompileAssert(test, msg) \ + typedef char GPBInternalCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ] #endif // __has_feature(c_static_assert) || __has_extension(c_static_assert) -#endif // _GPBCompileAssert +#endif // GPBInternalCompileAssert // Sanity check that there isn't padding between the field description // structures with and without a default. -_GPBCompileAssert(sizeof(GPBMessageFieldDescriptionWithDefault) == - (sizeof(GPBGenericValue) + - sizeof(GPBMessageFieldDescription)), - DescriptionsWithDefault_different_size_than_expected); +GPBInternalCompileAssert(sizeof(GPBMessageFieldDescriptionWithDefault) == + (sizeof(GPBGenericValue) + + sizeof(GPBMessageFieldDescription)), + DescriptionsWithDefault_different_size_than_expected); CF_EXTERN_C_END |