Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all the warnings and re-enable on CI #1872

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Source/ASControlNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#import <AsyncDisplayKit/ASControlTargetAction.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASThread.h>
#if TARGET_OS_TV
#import <AsyncDisplayKit/ASControlNode+Private.h>
#endif

// UIControl allows dragging some distance outside of the control itself during
// tracking. This value depends on the device idiom (25 or 70 points), so
Expand Down
2 changes: 1 addition & 1 deletion Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ - (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body

- (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTraitCollection)previousTraitCollection
{
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, tvOS 10.0, *)) {
// When changing between light and dark mode, often the entire node needs to re-render.
// This change doesn't happen frequently so it's fairly safe to render nodes again
__instanceLock__.lock();
Expand Down
4 changes: 2 additions & 2 deletions Source/ASViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ - (ASInterfaceState)interfaceState

- (UIEdgeInsets)additionalSafeAreaInsets
{
if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
return super.additionalSafeAreaInsets;
}

Expand All @@ -295,7 +295,7 @@ - (UIEdgeInsets)additionalSafeAreaInsets

- (void)setAdditionalSafeAreaInsets:(UIEdgeInsets)additionalSafeAreaInsets
{
if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
[super setAdditionalSafeAreaInsets:additionalSafeAreaInsets];
} else {
_fallbackAdditionalSafeAreaInsets = additionalSafeAreaInsets;
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASGraphicsContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#if AS_AT_LEAST_IOS13
#define ASPerformBlockWithTraitCollection(work, traitCollection) \
if (@available(iOS 13.0, *)) { \
if (@available(iOS 13.0, tvOS 13.0, *)) { \
UITraitCollection *uiTraitCollection = ASPrimitiveTraitCollectionToUITraitCollection(traitCollection); \
[uiTraitCollection performAsCurrentTraitCollection:^{ \
work(); \
Expand Down
3 changes: 3 additions & 0 deletions Source/Details/ASRecursiveUnfairLock.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@
#define rul_set_thread(l, t) atomic_store_explicit(&l->_thread, t, memory_order_relaxed)
#define rul_get_thread(l) atomic_load_explicit(&l->_thread, memory_order_relaxed)

OS_UNFAIR_LOCK_AVAILABILITY
NS_INLINE void ASRecursiveUnfairLockDidAcquire(ASRecursiveUnfairLock *l, pthread_t tid) {
NSCAssert(pthread_equal(rul_get_thread(l), NULL) && l->_count == 0, @"Unfair lock error");
rul_set_thread(l, tid);
}

OS_UNFAIR_LOCK_AVAILABILITY
NS_INLINE void ASRecursiveUnfairLockWillRelease(ASRecursiveUnfairLock *l) {
NSCAssert(pthread_equal(rul_get_thread(l), pthread_self()) && l->_count == 0, @"Unfair lock error");
rul_set_thread(l, NULL);
}

OS_UNFAIR_LOCK_AVAILABILITY
NS_INLINE void ASRecursiveUnfairLockAssertHeld(ASRecursiveUnfairLock *l) {
NSCAssert(pthread_equal(rul_get_thread(l), pthread_self()) && l->_count > 0, @"Unfair lock error");
}
Expand Down
24 changes: 20 additions & 4 deletions Source/Details/ASThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ namespace AS {
success = os_unfair_lock_trylock(&_unfair);
break;
case RecursiveUnfair:
success = ASRecursiveUnfairLockTryLock(&_runfair);
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
success = ASRecursiveUnfairLockTryLock(&_runfair);
} else {
success = _recursive.try_lock();
}
break;
}
if (success) {
Expand All @@ -180,7 +184,11 @@ namespace AS {
os_unfair_lock_lock(&_unfair);
break;
case RecursiveUnfair:
ASRecursiveUnfairLockLock(&_runfair);
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
ASRecursiveUnfairLockLock(&_runfair);
} else {
_recursive.lock();
}
break;
}
DidLock();
Expand All @@ -199,7 +207,11 @@ namespace AS {
os_unfair_lock_unlock(&_unfair);
break;
case RecursiveUnfair:
ASRecursiveUnfairLockUnlock(&_runfair);
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
ASRecursiveUnfairLockUnlock(&_runfair);
} else {
_recursive.unlock();
}
break;
}
}
Expand All @@ -225,7 +237,11 @@ namespace AS {
if (recursive) {
if (gMutex_unfair) {
_type = RecursiveUnfair;
_runfair = AS_RECURSIVE_UNFAIR_LOCK_INIT;
if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) {
_runfair = AS_RECURSIVE_UNFAIR_LOCK_INIT;
} else {
new (&_recursive) std::recursive_mutex();
}
} else {
_type = Recursive;
new (&_recursive) std::recursive_mutex();
Expand Down
20 changes: 11 additions & 9 deletions Source/Details/ASTraitCollection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault() {
tc.horizontalSizeClass = UIUserInterfaceSizeClassUnspecified;
tc.verticalSizeClass = UIUserInterfaceSizeClassUnspecified;
tc.containerSize = CGSizeZero;
if (AS_AVAILABLE_IOS(10)) {
if (AS_AVAILABLE_IOS_TVOS(10, 10)) {
tc.displayGamut = UIDisplayGamutUnspecified;
tc.preferredContentSizeCategory = UIContentSizeCategoryUnspecified;
tc.layoutDirection = UITraitEnvironmentLayoutDirectionUnspecified;
Expand All @@ -48,7 +48,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault() {
}
#endif

if (AS_AVAILABLE_IOS(13)) {
if (AS_AVAILABLE_IOS_TVOS(13, 13)) {
tc.accessibilityContrast = UIAccessibilityContrastUnspecified;
tc.legibilityWeight = UILegibilityWeightUnspecified;
}
Expand All @@ -62,7 +62,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITra
environmentTraitCollection.displayScale = traitCollection.displayScale;
environmentTraitCollection.userInterfaceIdiom = traitCollection.userInterfaceIdiom;
environmentTraitCollection.forceTouchCapability = traitCollection.forceTouchCapability;
if (AS_AVAILABLE_IOS(10)) {
if (AS_AVAILABLE_IOS_TVOS(10, 10)) {
environmentTraitCollection.displayGamut = traitCollection.displayGamut;
environmentTraitCollection.layoutDirection = traitCollection.layoutDirection;

Expand All @@ -79,7 +79,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITra
}
#endif

if (AS_AVAILABLE_IOS(13)) {
if (AS_AVAILABLE_IOS_TVOS(13, 13)) {
environmentTraitCollection.accessibilityContrast = traitCollection.accessibilityContrast;
environmentTraitCollection.legibilityWeight = traitCollection.legibilityWeight;
}
Expand All @@ -95,7 +95,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITra
[UITraitCollection traitCollectionWithForceTouchCapability:traitCollection.forceTouchCapability],
]];

if (AS_AVAILABLE_IOS(10)) {
if (AS_AVAILABLE_IOS_TVOS(10, 10)) {
[collections addObject:[UITraitCollection traitCollectionWithDisplayGamut:traitCollection.displayGamut]];
[collections addObject:[UITraitCollection traitCollectionWithLayoutDirection:traitCollection.layoutDirection]];
[collections addObject:[UITraitCollection traitCollectionWithPreferredContentSizeCategory:traitCollection.preferredContentSizeCategory]];
Expand Down Expand Up @@ -191,8 +191,9 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr
}
}

#if TARGET_OS_IOS
// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline
API_AVAILABLE(ios(13)) API_UNAVAILABLE(tvos)
API_AVAILABLE(ios(13))
ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentUserInterfaceLevel(UIUserInterfaceLevel userInterfaceLevel) {
switch (userInterfaceLevel) {
case UIUserInterfaceLevelBase:
Expand All @@ -203,6 +204,7 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr
return @"Unspecified";
}
}
#endif

// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline
API_AVAILABLE(ios(13))
Expand Down Expand Up @@ -242,7 +244,7 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr
if (AS_AVAILABLE_IOS_TVOS(12, 10)) {
[props addObject:@{ @"userInterfaceStyle": AS_NSStringFromUIUserInterfaceStyle(traits.userInterfaceStyle) }];
}
if (AS_AVAILABLE_IOS(10)) {
if (AS_AVAILABLE_IOS_TVOS(10, 10)) {
[props addObject:@{ @"layoutDirection": AS_NSStringFromUITraitEnvironmentLayoutDirection(traits.layoutDirection) }];
if (traits.preferredContentSizeCategory != nil) {
[props addObject:@{ @"preferredContentSizeCategory": traits.preferredContentSizeCategory }];
Expand All @@ -256,7 +258,7 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr
}
#endif

if (AS_AVAILABLE_IOS(13)) {
if (AS_AVAILABLE_IOS_TVOS(13, 13)) {
[props addObject:@{ @"accessibilityContrast": AS_NSStringFromUITraitEnvironmentAccessibilityContrast(traits.accessibilityContrast) }];
[props addObject:@{ @"legibilityWeight": AS_NSStringFromUITraitEnvironmentLegibilityWeight(traits.legibilityWeight) }];
}
Expand All @@ -272,7 +274,7 @@ @implementation ASTraitCollection {

+ (ASTraitCollection *)traitCollectionWithASPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traits NS_RETURNS_RETAINED {
ASTraitCollection *tc = [[ASTraitCollection alloc] init];
if (AS_AVAILABLE_IOS(10)) {
if (AS_AVAILABLE_IOS_TVOS(10, 10)) {
ASDisplayNodeCAssertPermanent(traits.preferredContentSizeCategory);
}
tc->_prim = traits;
Expand Down
6 changes: 3 additions & 3 deletions Source/Private/ASDisplayNode+UIViewBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ - (UIEdgeInsets)safeAreaInsets
{
_bridge_prologue_read;

if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
if (!_flags.layerBacked && _loaded(self)) {
return self.view.safeAreaInsets;
}
Expand All @@ -1029,7 +1029,7 @@ - (void)setInsetsLayoutMarginsFromSafeArea:(BOOL)insetsLayoutMarginsFromSafeArea

_flags.fallbackInsetsLayoutMarginsFromSafeArea = insetsLayoutMarginsFromSafeArea;

if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
if (!_flags.layerBacked) {
_setToViewOnly(insetsLayoutMarginsFromSafeArea, insetsLayoutMarginsFromSafeArea);
}
Expand Down Expand Up @@ -1106,7 +1106,7 @@ - (void)setLayerMaskedCorners:(CACornerMask)newLayerMaskedCorners
- (BOOL)_locked_insetsLayoutMarginsFromSafeArea
{
DISABLED_ASAssertLocked(__instanceLock__);
if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
if (!_flags.layerBacked) {
return _getFromViewOnly(insetsLayoutMarginsFromSafeArea);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Private/ASIGListAdapterBasedDataSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ - (void)collectionNode:(ASCollectionNode *)collectionNode willDisplayItemWithNod
{
NSIndexPath *indexPath = [collectionNode.view indexPathForNode:node];
UIView *contentView = node.view.superview;
UICollectionViewCell *cell = contentView.superview;
UICollectionViewCell *cell = (UICollectionViewCell *)contentView.superview;

if (cell == nil || indexPath == nil) {
return;
Expand All @@ -179,7 +179,7 @@ - (void)collectionNode:(ASCollectionNode *)collectionNode didEndDisplayingItemWi
{
NSIndexPath *indexPath = [collectionNode.view indexPathForNode:node];
UIView *contentView = node.view.superview;
UICollectionViewCell *cell = contentView.superview;
UICollectionViewCell *cell = (UICollectionViewCell *)contentView.superview;

if (cell == nil || indexPath == nil) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/_ASPendingState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ - (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPr
if (flags.setPreservesSuperviewLayoutMargins)
view.preservesSuperviewLayoutMargins = _flags.preservesSuperviewLayoutMargins;

if (AS_AVAILABLE_IOS(11.0)) {
if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) {
if (flags.setInsetsLayoutMarginsFromSafeArea) {
view.insetsLayoutMarginsFromSafeArea = _flags.insetsLayoutMarginsFromSafeArea;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/UIImage+ASConvenience.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ @implementation UIImage (ASDKFastImageNamed)
NSString *imageKey = imageName;
if (traitCollection) {
char imageKeyBuffer[256];
if (@available(iOS 12.0, *)) {
if (@available(iOS 12.0, tvOS 10.0, *)) {
snprintf(imageKeyBuffer, sizeof(imageKeyBuffer), "%s|%ld|%ld|%ld", imageName.UTF8String, (long)traitCollection.horizontalSizeClass, (long)traitCollection.verticalSizeClass, (long)traitCollection.userInterfaceStyle);
} else {
// Fallback on earlier versions
Expand Down
2 changes: 1 addition & 1 deletion Texture.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|

# Subspecs
spec.subspec 'Core' do |core|
core.compiler_flags = '-fno-exceptions -Wno-implicit-retain-self'
Copy link
Member Author

@garrettmoon garrettmoon Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this was in here and -W flags are considered Cocoapod warnings.

core.compiler_flags = '-fno-exceptions'
core.public_header_files = [
'Source/*.h',
'Source/Details/**/*.h',
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function build_example {

# Lint subspec
function lint_subspec {
set -o pipefail && pod env && pod lib lint --allow-warnings --subspec="$1"
set -o pipefail && pod env && pod lib lint --subspec="$1"
}

function cleanup {
Expand Down Expand Up @@ -218,7 +218,7 @@ framework|all)
cocoapods-lint|all)
echo "Verifying that podspec lints."

set -o pipefail && pod env && pod lib lint --allow-warnings
set -o pipefail && pod env && pod lib lint
success="1"
;;

Expand Down