From c8a440dfb68074ff310e624928cd2dd61c101728 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Wed, 25 May 2016 13:46:00 -0400 Subject: 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. --- objectivec/GPBDictionary.m | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'objectivec/GPBDictionary.m') diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m index 3bd146e0..0f0241a1 100644 --- a/objectivec/GPBDictionary.m +++ b/objectivec/GPBDictionary.m @@ -45,6 +45,12 @@ // directly. // ------------------------------------------------------------------ +// 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" + // Used to include code only visible to specific versions of the static // analyzer. Useful for wrapping code that only exists to silence the analyzer. // Determine the values you want to use for BEGIN_APPLE_BUILD_VERSION, @@ -484,6 +490,8 @@ void GPBDictionaryReadEntry(id mapDictionary, key.valueString = [@"" retain]; } if (GPBDataTypeIsObject(valueDataType) && value.valueString == nil) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" switch (valueDataType) { case GPBDataTypeString: value.valueString = [@"" retain]; @@ -505,6 +513,7 @@ void GPBDictionaryReadEntry(id mapDictionary, // Nothing break; } +#pragma clang diagnostic pop } if ((keyDataType == GPBDataTypeString) && GPBDataTypeIsObject(valueDataType)) { @@ -13553,3 +13562,5 @@ void GPBDictionaryReadEntry(id mapDictionary, } @end + +#pragma clang diagnostic pop -- cgit v1.2.3