Need to check availability before use of macros. (#3254)

* Need to check availability before use of macros.

* Get rid of PCH and enforce macro definition.

* Remove prefix

* Switch to global warning instead, much better.
This commit is contained in:
Garrett Moon 2017-04-10 15:06:40 -07:00 committed by GitHub
parent 68a8d5f468
commit 8c3775f5e2
26 changed files with 62 additions and 41 deletions

View File

@ -19,7 +19,6 @@ Pod::Spec.new do |spec|
# Subspecs
spec.subspec 'Core' do |core|
core.prefix_header_file = 'Source/AsyncDisplayKit-Prefix.pch'
core.public_header_files = [
'Source/*.h',
'Source/Details/**/*.h',

View File

@ -304,13 +304,13 @@
C78F7E2B1BF7809800CDEAFC /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B0F880581BEAEC7500D17647 /* ASTableNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
CC034A011E5FAF9700626263 /* ASElementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = CC0349FF1E5FAF9700626263 /* ASElementMap.h */; };
CC034A021E5FAF9700626263 /* ASElementMap.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A001E5FAF9700626263 /* ASElementMap.m */; };
CC034A091E60BEB400626263 /* ASDisplayNode+Convenience.h in Headers */ = {isa = PBXBuildFile; fileRef = CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
CC034A0A1E60BEB400626263 /* ASDisplayNode+Convenience.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */; };
CC034A0D1E60C3D500626263 /* ASRectTable.h in Headers */ = {isa = PBXBuildFile; fileRef = CC034A0B1E60C3D500626263 /* ASRectTable.h */; };
CC034A0E1E60C3D500626263 /* ASRectTable.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A0C1E60C3D500626263 /* ASRectTable.m */; };
CC034A101E60C9BF00626263 /* ASRectTableTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A0F1E60C9BF00626263 /* ASRectTableTests.m */; };
CC034A131E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = CC034A111E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.h */; };
CC034A141E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A121E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.m */; };
CC034A091E60BEB400626263 /* ASDisplayNode+Convenience.h in Headers */ = {isa = PBXBuildFile; fileRef = CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
CC034A0A1E60BEB400626263 /* ASDisplayNode+Convenience.m in Sources */ = {isa = PBXBuildFile; fileRef = CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */; };
CC051F1F1D7A286A006434CB /* ASCALayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC051F1E1D7A286A006434CB /* ASCALayerTests.m */; };
CC0AEEA41D66316E005D1C78 /* ASUICollectionViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0AEEA31D66316E005D1C78 /* ASUICollectionViewTests.m */; };
CC0F885B1E42807F00576FED /* ASCollectionViewFlowLayoutInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0F88591E42807F00576FED /* ASCollectionViewFlowLayoutInspector.m */; };
@ -698,13 +698,13 @@
BDC2D162BD55A807C1475DA5 /* Pods-AsyncDisplayKitTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AsyncDisplayKitTests.profile.xcconfig"; path = "Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests.profile.xcconfig"; sourceTree = "<group>"; };
CC0349FF1E5FAF9700626263 /* ASElementMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASElementMap.h; sourceTree = "<group>"; };
CC034A001E5FAF9700626263 /* ASElementMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASElementMap.m; sourceTree = "<group>"; };
CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Convenience.h"; sourceTree = "<group>"; };
CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASDisplayNode+Convenience.m"; sourceTree = "<group>"; };
CC034A0B1E60C3D500626263 /* ASRectTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASRectTable.h; sourceTree = "<group>"; };
CC034A0C1E60C3D500626263 /* ASRectTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASRectTable.m; sourceTree = "<group>"; };
CC034A0F1E60C9BF00626263 /* ASRectTableTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASRectTableTests.m; sourceTree = "<group>"; };
CC034A111E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AsyncDisplayKit+IGListKitMethods.h"; sourceTree = "<group>"; };
CC034A121E649F1300626263 /* AsyncDisplayKit+IGListKitMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AsyncDisplayKit+IGListKitMethods.m"; sourceTree = "<group>"; };
CC034A071E60BEB400626263 /* ASDisplayNode+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Convenience.h"; sourceTree = "<group>"; };
CC034A081E60BEB400626263 /* ASDisplayNode+Convenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ASDisplayNode+Convenience.m"; sourceTree = "<group>"; };
CC051F1E1D7A286A006434CB /* ASCALayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCALayerTests.m; sourceTree = "<group>"; };
CC0AEEA31D66316E005D1C78 /* ASUICollectionViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASUICollectionViewTests.m; sourceTree = "<group>"; };
CC0F88591E42807F00576FED /* ASCollectionViewFlowLayoutInspector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASCollectionViewFlowLayoutInspector.m; sourceTree = "<group>"; };
@ -2170,13 +2170,13 @@
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Source/AsyncDisplayKit-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap;
MTL_ENABLE_DEBUG_INFO = YES;
OTHER_CFLAGS = "-Wundef";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = AsyncDisplayKit;
SKIP_INSTALL = YES;
@ -2202,12 +2202,12 @@
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Source/AsyncDisplayKit-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "-Wundef";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = AsyncDisplayKit;
SKIP_INSTALL = YES;
@ -2315,12 +2315,12 @@
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Source/AsyncDisplayKit-Prefix.pch";
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MODULEMAP_FILE = Source/AsyncDisplayKit.modulemap;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "-Wundef";
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = AsyncDisplayKit;
SKIP_INSTALL = YES;

View File

@ -8,6 +8,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASDisplayNode.h>
#import <AsyncDisplayKit/ASLayoutRangeType.h>
#import <AsyncDisplayKit/ASEventLog.h>

View File

@ -6,6 +6,7 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#import <AsyncDisplayKit/ASAvailability.h>
#if YOGA /* YOGA */

View File

@ -24,6 +24,7 @@
#import <AsyncDisplayKit/ASNetworkImageNode.h>
#import <AsyncDisplayKit/ASWeakProxy.h>
#define ASAnimatedImageDebug 0
@interface ASNetworkImageNode (Private)
- (void)_locked_setDefaultImage:(UIImage *)image;

View File

@ -8,6 +8,8 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_IOS
#import <AsyncDisplayKit/ASMapNode.h>

View File

@ -11,13 +11,14 @@
#import <AsyncDisplayKit/ASMultiplexImageNode.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkSubclasses.h>
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
#import <AsyncDisplayKit/ASPhotosFrameworkImageRequest.h>
#import <AsyncDisplayKit/ASEqualityHelpers.h>
#import <AsyncDisplayKit/ASInternalHelpers.h>
#if PIN_REMOTE_IMAGE
#if AS_PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASPINRemoteImageDownloader.h>
#else
#import <AsyncDisplayKit/ASBasicImageDownloader.h>
@ -171,7 +172,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
- (instancetype)init
{
#if PIN_REMOTE_IMAGE
#if AS_PIN_REMOTE_IMAGE
return [self initWithCache:[ASPINRemoteImageDownloader sharedDownloader] downloader:[ASPINRemoteImageDownloader sharedDownloader]];
#else
return [self initWithCache:nil downloader:[ASBasicImageDownloader sharedImageDownloader]];

View File

@ -10,6 +10,7 @@
#import <AsyncDisplayKit/ASNetworkImageNode.h>
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASBasicImageDownloader.h>
#import <AsyncDisplayKit/ASDisplayNodeExtras.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkSubclasses.h>
@ -19,7 +20,7 @@
#import <AsyncDisplayKit/ASImageNode+AnimatedImagePrivate.h>
#import <AsyncDisplayKit/ASImageContainerProtocolCategories.h>
#if PIN_REMOTE_IMAGE
#if AS_PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASPINRemoteImageDownloader.h>
#endif
@ -100,7 +101,7 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
- (instancetype)init
{
#if PIN_REMOTE_IMAGE
#if AS_PIN_REMOTE_IMAGE
return [self initWithCache:[ASPINRemoteImageDownloader sharedDownloader] downloader:[ASPINRemoteImageDownloader sharedDownloader]];
#else
return [self initWithCache:nil downloader:[ASBasicImageDownloader sharedImageDownloader]];

View File

@ -10,6 +10,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASRunLoopQueue.h>
#import <AsyncDisplayKit/ASThread.h>
#import <AsyncDisplayKit/ASLog.h>
@ -282,13 +283,13 @@ static void runLoopSourceCallback(void *info) {
// itemsToProcess will be empty if _queueConsumer == nil so no need to check again.
if (itemsToProcess.empty() == false) {
#if ASRunloopQueueLoggingEnabled
#if ASRunLoopQueueLoggingEnabled
NSLog(@"<%@> - Starting processing of: %ld", self, itemsToProcess.size());
#endif
auto itemsEnd = itemsToProcess.cend();
for (auto iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) {
_queueConsumer(*iterator, isQueueDrained && iterator == itemsEnd - 1);
#if ASRunloopQueueLoggingEnabled
#if ASRunLoopQueueLoggingEnabled
NSLog(@"<%@> - Finished processing 1 item", self);
#endif
}

View File

@ -10,6 +10,8 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_IOS
#import <AsyncDisplayKit/ASVideoPlayerNode.h>

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import "AsyncDisplayKit+IGListKitMethods.h"
#import <AsyncDisplayKit/ASAssert.h>
@ -44,4 +46,4 @@
@end
#endif // IG_LIST_KIT
#endif // AS_IG_LIST_KIT

View File

@ -1,11 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif
#import <AsyncDisplayKit/ASAvailability.h>

View File

@ -40,7 +40,8 @@
#import <AsyncDisplayKit/ASSectionController.h>
#import <AsyncDisplayKit/ASSupplementaryNodeSource.h>
#if IG_LIST_KIT
#if AS_IG_LIST_KIT
#import <AsyncDisplayKit/IGListAdapter+AsyncDisplayKit.h>
#import <AsyncDisplayKit/AsyncDisplayKit+IGListKitMethods.h>
#endif

View File

@ -33,8 +33,8 @@
#define YOGA __has_include(YOGA_HEADER_PATH)
#endif
#define PIN_REMOTE_IMAGE __has_include(<PINRemoteImage/PINRemoteImage.h>)
#define IG_LIST_KIT __has_include(<IGListKit/IGListKit.h>)
#define AS_PIN_REMOTE_IMAGE __has_include(<PINRemoteImage/PINRemoteImage.h>)
#define AS_IG_LIST_KIT __has_include(<IGListKit/IGListKit.h>)
/**
* For IGListKit versions < 3.0, you have to use IGListCollectionView.

View File

@ -18,7 +18,7 @@
#define ASMultiplexImageNodeCLogError(...)
// Note: `<sys/kdebug_signpost.h>` only exists in Xcode 8 and later.
#if PROFILE && __has_include("<sys/kdebug_signpost.h>")
#if defined(PROFILE) && __has_include("<sys/kdebug_signpost.h>")
#import <sys/kdebug_signpost.h>

View File

@ -10,7 +10,9 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#if PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASImageProtocols.h>

View File

@ -10,7 +10,9 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#if PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_PIN_REMOTE_IMAGE
#import <AsyncDisplayKit/ASPINRemoteImageDownloader.h>
#import <AsyncDisplayKit/ASAssert.h>

View File

@ -10,6 +10,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASTraitCollection.h>
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
#import <AsyncDisplayKit/ASLayoutElement.h>

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import <IGListKit/IGListKit.h>
@ -31,4 +33,4 @@ NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_END
#endif // IG_LIST_KIT
#endif // AS_IG_LIST_KIT

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import "IGListAdapter+AsyncDisplayKit.h"
#import "ASIGListAdapterBasedDataSource.h"
@ -47,4 +49,4 @@
@end
#endif // IG_LIST_KIT
#endif // AS_IG_LIST_KIT

View File

@ -11,6 +11,7 @@
//
#import "ASDisplayNode+FrameworkPrivate.h"
#import <AsyncDisplayKit/ASAvailability.h>
#import <AsyncDisplayKit/ASLayout.h>
#import <AsyncDisplayKit/ASLayoutElement.h>
#import <AsyncDisplayKit/ASThread.h>

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import <IGListKit/IGListKit.h>
#import <AsyncDisplayKit/ASCollectionView.h>

View File

@ -6,7 +6,9 @@
// Copyright © 2017 Facebook. All rights reserved.
//
#if IG_LIST_KIT
#import <AsyncDisplayKit/ASAvailability.h>
#if AS_IG_LIST_KIT
#import "ASIGListAdapterBasedDataSource.h"
#import <AsyncDisplayKit/AsyncDisplayKit.h>
@ -316,4 +318,4 @@ typedef struct {
@end
#endif // IG_LIST_KIT
#endif // AS_IG_LIST_KIT

View File

@ -9,6 +9,9 @@
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_TV
#import <AsyncDisplayKit/ASControlNode+tvOS.h>

View File

@ -10,6 +10,7 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_TV
#import <AsyncDisplayKit/ASImageNode+tvOS.h>