From 3b14c7f272e87dbac86c55fc718bcef4c81f38b2 Mon Sep 17 00:00:00 2001 From: Miro Knejp Date: Fri, 15 Jul 2016 16:00:07 +0200 Subject: [PATCH] Suppress -Wdirect-ivar-access in generated objcpp files --- .../objc/TXSSortItems+Private.mm | 1 + .../objc/TextSort.xcodeproj/project.pbxproj | 7 ++++--- .../xcshareddata/xcschemes/TextSort.xcscheme | 19 ++++++++++++------- example/objc/TextSort/TextSort-Info.plist | 2 +- src/source/ObjcppGenerator.scala | 4 ++++ .../generated-src/objc/DBConflict+Private.mm | 1 + .../objc/DBConflictUser+Private.mm | 1 + .../objc/DBConstantsInterface+Private.mm | 1 + .../objc/DBCppException+Private.mm | 1 + .../objc/DBExternInterface1+Private.mm | 1 + .../objc/DBListenerCaller+Private.mm | 1 + .../generated-src/objc/DBReturnOne+Private.mm | 1 + .../generated-src/objc/DBReturnTwo+Private.mm | 1 + .../objc/DBReverseClientInterface+Private.mm | 1 + .../objc/DBTestDuration+Private.mm | 1 + .../objc/DBTestHelpers+Private.mm | 1 + .../generated-src/objc/DBUserToken+Private.mm | 1 + .../DBUsesSingleLanguageListeners+Private.mm | 1 + 18 files changed, 35 insertions(+), 11 deletions(-) diff --git a/example/generated-src/objc/TXSSortItems+Private.mm b/example/generated-src/objc/TXSSortItems+Private.mm index 548b73c3b..548944453 100644 --- a/example/generated-src/objc/TXSSortItems+Private.mm +++ b/example/generated-src/objc/TXSSortItems+Private.mm @@ -13,6 +13,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface TXSSortItems () diff --git a/example/objc/TextSort.xcodeproj/project.pbxproj b/example/objc/TextSort.xcodeproj/project.pbxproj index 8f534fb5f..81986bbf8 100644 --- a/example/objc/TextSort.xcodeproj/project.pbxproj +++ b/example/objc/TextSort.xcodeproj/project.pbxproj @@ -150,7 +150,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = TXS; - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0730; ORGANIZATIONNAME = "Dropbox, Inc."; }; buildConfigurationList = 65834DD819AC599E0061AD3F /* Build configuration list for PBXProject "TextSort" */; @@ -236,6 +236,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -250,7 +251,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -284,7 +284,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../support-lib/objc $(SRCROOT)/../generated-src/objc"; @@ -301,6 +300,7 @@ GCC_PREFIX_HEADER = "TextSort/TextSort-Prefix.pch"; INFOPLIST_FILE = "TextSort/TextSort-Info.plist"; LIBRARY_SEARCH_PATHS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = "Dropbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; WRAPPER_EXTENSION = app; @@ -316,6 +316,7 @@ GCC_PREFIX_HEADER = "TextSort/TextSort-Prefix.pch"; INFOPLIST_FILE = "TextSort/TextSort-Info.plist"; LIBRARY_SEARCH_PATHS = "$(inherited)"; + PRODUCT_BUNDLE_IDENTIFIER = "Dropbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = 1; WRAPPER_EXTENSION = app; diff --git a/example/objc/TextSort.xcodeproj/xcshareddata/xcschemes/TextSort.xcscheme b/example/objc/TextSort.xcodeproj/xcshareddata/xcschemes/TextSort.xcscheme index f3120ac80..b5c1ee841 100644 --- a/example/objc/TextSort.xcodeproj/xcshareddata/xcschemes/TextSort.xcscheme +++ b/example/objc/TextSort.xcodeproj/xcshareddata/xcschemes/TextSort.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,17 +38,21 @@ ReferencedContainer = "container:TextSort.xcodeproj"> + + - + - + CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - Dropbox.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/src/source/ObjcppGenerator.scala b/src/source/ObjcppGenerator.scala index 64877ab0b..abb1e37e4 100644 --- a/src/source/ObjcppGenerator.scala +++ b/src/source/ObjcppGenerator.scala @@ -138,6 +138,10 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) { val objcSelf = if (i.ext.objc && i.ext.cpp) self + "CppProxy" else self if (i.ext.cpp) { + // Disable warnings in Clang about directly accessing the ivars of an object + w.wl("#if __clang__") + w.wl("#pragma clang diagnostic ignored \"-Wdirect-ivar-access\"") + w.wl("#endif") w.wl if (i.ext.objc) w.wl(s"@interface $objcSelf : NSObject<$self>") diff --git a/test-suite/generated-src/objc/DBConflict+Private.mm b/test-suite/generated-src/objc/DBConflict+Private.mm index 46d0b9459..d31d8fbd9 100644 --- a/test-suite/generated-src/objc/DBConflict+Private.mm +++ b/test-suite/generated-src/objc/DBConflict+Private.mm @@ -9,6 +9,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBConflict () diff --git a/test-suite/generated-src/objc/DBConflictUser+Private.mm b/test-suite/generated-src/objc/DBConflictUser+Private.mm index a17ed6909..ab1830356 100644 --- a/test-suite/generated-src/objc/DBConflictUser+Private.mm +++ b/test-suite/generated-src/objc/DBConflictUser+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBConflictUser () diff --git a/test-suite/generated-src/objc/DBConstantsInterface+Private.mm b/test-suite/generated-src/objc/DBConstantsInterface+Private.mm index 28d34f0cd..3c6239974 100644 --- a/test-suite/generated-src/objc/DBConstantsInterface+Private.mm +++ b/test-suite/generated-src/objc/DBConstantsInterface+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBConstantsInterface () diff --git a/test-suite/generated-src/objc/DBCppException+Private.mm b/test-suite/generated-src/objc/DBCppException+Private.mm index d64717f03..6df2f8aaf 100644 --- a/test-suite/generated-src/objc/DBCppException+Private.mm +++ b/test-suite/generated-src/objc/DBCppException+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBCppException () diff --git a/test-suite/generated-src/objc/DBExternInterface1+Private.mm b/test-suite/generated-src/objc/DBExternInterface1+Private.mm index 34c07564c..0c87c9cb2 100644 --- a/test-suite/generated-src/objc/DBExternInterface1+Private.mm +++ b/test-suite/generated-src/objc/DBExternInterface1+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBExternInterface1 () diff --git a/test-suite/generated-src/objc/DBListenerCaller+Private.mm b/test-suite/generated-src/objc/DBListenerCaller+Private.mm index 855fe17c5..7f8ccaea0 100644 --- a/test-suite/generated-src/objc/DBListenerCaller+Private.mm +++ b/test-suite/generated-src/objc/DBListenerCaller+Private.mm @@ -12,6 +12,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBListenerCaller () diff --git a/test-suite/generated-src/objc/DBReturnOne+Private.mm b/test-suite/generated-src/objc/DBReturnOne+Private.mm index ebacf8025..edd1cb018 100644 --- a/test-suite/generated-src/objc/DBReturnOne+Private.mm +++ b/test-suite/generated-src/objc/DBReturnOne+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBReturnOne () diff --git a/test-suite/generated-src/objc/DBReturnTwo+Private.mm b/test-suite/generated-src/objc/DBReturnTwo+Private.mm index ca6201a39..8219c9496 100644 --- a/test-suite/generated-src/objc/DBReturnTwo+Private.mm +++ b/test-suite/generated-src/objc/DBReturnTwo+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBReturnTwo () diff --git a/test-suite/generated-src/objc/DBReverseClientInterface+Private.mm b/test-suite/generated-src/objc/DBReverseClientInterface+Private.mm index 391059729..fc1876a86 100644 --- a/test-suite/generated-src/objc/DBReverseClientInterface+Private.mm +++ b/test-suite/generated-src/objc/DBReverseClientInterface+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBReverseClientInterface () diff --git a/test-suite/generated-src/objc/DBTestDuration+Private.mm b/test-suite/generated-src/objc/DBTestDuration+Private.mm index b0d597746..bfb488911 100644 --- a/test-suite/generated-src/objc/DBTestDuration+Private.mm +++ b/test-suite/generated-src/objc/DBTestDuration+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBTestDuration () diff --git a/test-suite/generated-src/objc/DBTestHelpers+Private.mm b/test-suite/generated-src/objc/DBTestHelpers+Private.mm index f51065b7f..da7c05735 100644 --- a/test-suite/generated-src/objc/DBTestHelpers+Private.mm +++ b/test-suite/generated-src/objc/DBTestHelpers+Private.mm @@ -17,6 +17,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBTestHelpers () diff --git a/test-suite/generated-src/objc/DBUserToken+Private.mm b/test-suite/generated-src/objc/DBUserToken+Private.mm index 51e8c012d..f4894296e 100644 --- a/test-suite/generated-src/objc/DBUserToken+Private.mm +++ b/test-suite/generated-src/objc/DBUserToken+Private.mm @@ -11,6 +11,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBUserTokenCppProxy : NSObject diff --git a/test-suite/generated-src/objc/DBUsesSingleLanguageListeners+Private.mm b/test-suite/generated-src/objc/DBUsesSingleLanguageListeners+Private.mm index fbf6bed7c..edd5a7559 100644 --- a/test-suite/generated-src/objc/DBUsesSingleLanguageListeners+Private.mm +++ b/test-suite/generated-src/objc/DBUsesSingleLanguageListeners+Private.mm @@ -12,6 +12,7 @@ #include static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file"); +#pragma clang diagnostic ignored "-Wdirect-ivar-access" @interface DBUsesSingleLanguageListenersCppProxy : NSObject