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/GPBCodedOutputStream.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'objectivec/GPBCodedOutputStream.m') diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m index fd9ed66c..63ba8068 100644 --- a/objectivec/GPBCodedOutputStream.m +++ b/objectivec/GPBCodedOutputStream.m @@ -144,7 +144,7 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, GPBWriteRawByte(state, (int32_t)(value >> 56) & 0xFF); } -#if DEBUG && !defined(NS_BLOCK_ASSERTIONS) +#if defined(DEBUG) && DEBUG && !defined(NS_BLOCK_ASSERTIONS) + (void)load { // This test exists to verify that CFStrings with embedded NULLs will work // for us. If this Assert fails, all code below that depends on @@ -203,6 +203,12 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, return [[[self alloc] initWithData:data] autorelease]; } +// 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" + - (void)writeDoubleNoTag:(double)value { GPBWriteRawLittleEndian64(&state_, GPBConvertDoubleToInt64(value)); } @@ -981,6 +987,8 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state, GPBWriteRawLittleEndian64(&state_, value); } +#pragma clang diagnostic pop + @end size_t GPBComputeDoubleSizeNoTag(Float64 value) { -- cgit v1.2.3