From 6ed5ba29f8d1600a632ddd5a9d901b72888b1c93 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Mon, 16 Jul 2018 09:38:12 -0700 Subject: [PATCH] Turn off exceptions to reduce binary size (-600KB for arm64) (#1033) * Turn off exceptions to reduce binary size * Changelog --- AsyncDisplayKit.xcodeproj/project.pbxproj | 18 +++++++++++++++--- BUCK | 2 ++ CHANGELOG.md | 1 + Source/ASDisplayNodeExtras.h | 2 +- Texture.podspec | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 5aad7bb9ed..bcc1796536 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -2738,7 +2738,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap; MTL_ENABLE_DEBUG_INFO = YES; - OTHER_CFLAGS = "-Wundef"; + OTHER_CFLAGS = ( + "-Wundef", + "-fno-exceptions", + "-fno-objc-arc-exceptions", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = AsyncDisplayKit; SKIP_INSTALL = YES; @@ -2767,7 +2771,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_CFLAGS = "-Wundef"; + OTHER_CFLAGS = ( + "-Wundef", + "-fno-exceptions", + "-fno-objc-arc-exceptions", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = AsyncDisplayKit; SKIP_INSTALL = YES; @@ -2881,7 +2889,11 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_CFLAGS = "-Wundef"; + OTHER_CFLAGS = ( + "-Wundef", + "-fno-exceptions", + "-fno-objc-arc-exceptions", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = AsyncDisplayKit; SKIP_INSTALL = YES; diff --git a/BUCK b/BUCK index 2527c2f053..9a3ad37a7b 100755 --- a/BUCK +++ b/BUCK @@ -4,6 +4,8 @@ COMMON_PREPROCESSOR_FLAGS = [ '-fobjc-arc', '-DDEBUG=1', + '-fno-exceptions', + '-fno-objc-arc-exceptions' ] COMMON_LANG_PREPROCESSOR_FLAGS = { diff --git a/CHANGELOG.md b/CHANGELOG.md index 07365f00eb..6c132eba59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Enable locking assertions (and add some more) to improve and enforce locking safety within the framework [Huy Nguyen](https://github.com/nguyenhuy) [#1024](https://github.com/TextureGroup/Texture/pull/1024) - Split MapKit, Photos, and AssetsLibrary dependent code into separate subspecs to improve binary size and start time when they're not needed. The default subspec includes all three for backwards compatibility, but this **will change in 3.0**. When using non-Cocoapods build environments, define `AS_USE_PHOTOS, AS_USE_MAPKIT, AS_USE_ASSETS_LIBRARY` to 1 respectively to signal their use. [Adlai Holler](https://github.com/Adlai-Holler) - Optimization: Removed an NSMutableArray in flattened layouts. [Adlai Holler](https://github.com/Adlai-Holler) +- Reduced binary size by disabling exception support (which we don't use.) [Adlai Holler](https://github.com/Adlai-Holler) ## 2.7 - Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877) diff --git a/Source/ASDisplayNodeExtras.h b/Source/ASDisplayNodeExtras.h index 9a8c2cd0c0..aa3fcbe57a 100644 --- a/Source/ASDisplayNodeExtras.h +++ b/Source/ASDisplayNodeExtras.h @@ -30,7 +30,7 @@ #define ASSetDebugName(node, format, ...) node.debugName = [NSString stringWithFormat:format, __VA_ARGS__] #define ASSetDebugNames(...) _ASSetDebugNames(self.class, @"" # __VA_ARGS__, __VA_ARGS__, nil) #else - #define ASSetDebugName(node, name) + #define ASSetDebugName(node, format, ...) #define ASSetDebugNames(...) #endif diff --git a/Texture.podspec b/Texture.podspec index c8a5f2be30..455cb080a5 100644 --- a/Texture.podspec +++ b/Texture.podspec @@ -16,6 +16,7 @@ Pod::Spec.new do |spec| # Subspecs spec.subspec 'Core' do |core| + core.compiler_flags = '-fno-exceptions -fno-objc-arc-exceptions' core.public_header_files = [ 'Source/*.h', 'Source/Details/**/*.h',