diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-05-25 13:46:00 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-05-25 16:42:31 -0400 |
commit | c8a440dfb68074ff310e624928cd2dd61c101728 (patch) | |
tree | 6b2251c56e7ccd125a7cc7bcb9fc276266f5adc5 /objectivec/GPBUnknownFieldSet.m | |
parent | d089f04ae53565aff77240172e1007f3959503f4 (diff) | |
download | protobuf-c8a440dfb68074ff310e624928cd2dd61c101728.tar.gz protobuf-c8a440dfb68074ff310e624928cd2dd61c101728.tar.bz2 protobuf-c8a440dfb68074ff310e624928cd2dd61c101728.zip |
Add more warnings to for the ObjC runtime build
Working on https://github.com/google/protobuf/issues/1599, specifically:
- Turn on more warnings that the Xcode UI calls out with individual controls.
- Manually add:
-Wundef
-Wswitch-enum
- Manually add and then diable in the unittests because of XCTest's headers:
-Wreserved-id-macro
-Wdocumentation-unknown-command
- Manually add -Wdirect-ivar-access, but disable it for the unittests and in
the library code (via #pragmas to suppress it). This is done so proto users
can enable the warning.
Diffstat (limited to 'objectivec/GPBUnknownFieldSet.m')
-rw-r--r-- | objectivec/GPBUnknownFieldSet.m | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/objectivec/GPBUnknownFieldSet.m b/objectivec/GPBUnknownFieldSet.m index 4ddc0d2a..af08556e 100644 --- a/objectivec/GPBUnknownFieldSet.m +++ b/objectivec/GPBUnknownFieldSet.m @@ -93,6 +93,12 @@ static void CopyWorker(const void *key, const void *value, void *context) { [copied release]; } +// 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" + - (id)copyWithZone:(NSZone *)zone { GPBUnknownFieldSet *result = [[GPBUnknownFieldSet allocWithZone:zone] init]; if (fields_) { @@ -148,7 +154,7 @@ static void CopyWorker(const void *key, const void *value, void *context) { } - (NSArray *)sortedFields { - if (!fields_) return nil; + if (!fields_) return [NSArray array]; size_t count = CFDictionaryGetCount(fields_); ssize_t keys[count]; GPBUnknownField *values[count]; @@ -420,4 +426,6 @@ static void GPBUnknownFieldSetMergeUnknownFields(const void *key, } } +#pragma clang diagnostic pop + @end |