Skip to content

Commit

Permalink
[src] Fix duplicate availability attributes. (#21819)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 20, 2024
1 parent a702a73 commit 0937cff
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/ObjCRuntime/PlatformAvailability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public override string ToString ()
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
#if !COREBUILD
[Obsolete ("Use [Introduced|Deprecated|Obsoleted|Unavailable] attributes with PlatformName.")]
#endif
Expand Down Expand Up @@ -541,6 +542,7 @@ public iOSAttribute (byte major, byte minor, byte subminor, bool onlyOn64)

}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
#if !COREBUILD
[Obsolete ("Use [Introduced|Deprecated|Obsoleted|Unavailable] attributes with PlatformName.")]
#endif
Expand Down
8 changes: 8 additions & 0 deletions src/ObjCRuntime/PlatformAvailability2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public UnavailableAttribute (PlatformName platform,
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class TVAttribute : IntroducedAttribute {
public TVAttribute (byte major, byte minor)
: base (PlatformName.TvOS, (int) major, (int) minor)
Expand All @@ -226,6 +227,7 @@ public TVAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class WatchAttribute : IntroducedAttribute {
public WatchAttribute (byte major, byte minor)
: base (PlatformName.WatchOS, (int) major, (int) minor)
Expand All @@ -250,6 +252,7 @@ public WatchAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class MacCatalystAttribute : IntroducedAttribute {
public MacCatalystAttribute (byte major, byte minor)
: base (PlatformName.MacCatalyst, (int) major, (int) minor)
Expand All @@ -262,34 +265,39 @@ public MacCatalystAttribute (byte major, byte minor, byte subminor)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoMacAttribute : UnavailableAttribute {
public NoMacAttribute ()
: base (PlatformName.MacOSX)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoiOSAttribute : UnavailableAttribute {
public NoiOSAttribute ()
: base (PlatformName.iOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoWatchAttribute : UnavailableAttribute {
public NoWatchAttribute ()
: base (PlatformName.WatchOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoTVAttribute : UnavailableAttribute {
public NoTVAttribute ()
: base (PlatformName.TvOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoMacCatalystAttribute : UnavailableAttribute {
public NoMacCatalystAttribute ()
: base (PlatformName.MacCatalyst)
Expand Down
2 changes: 2 additions & 0 deletions src/ObjCRuntime/PlatformAvailabilityShadow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// These _must_ be in a less nested namespace than the copies they are shadowing in PlatformAvailability.cs
// Since those are in ObjcRuntime these must be global
[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
#if COREBUILD
public
#endif
Expand Down Expand Up @@ -44,6 +45,7 @@ public MacAttribute (byte major, byte minor, byte subminor, PlatformArchitecture
{
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
#if COREBUILD
public
#endif
Expand Down
8 changes: 8 additions & 0 deletions src/bgen/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,7 @@ public UnavailableAttribute (PlatformName platform, string message = null)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class TVAttribute : IntroducedAttribute {
public TVAttribute (byte major, byte minor)
: base (PlatformName.TvOS, (int) major, (int) minor)
Expand All @@ -1101,6 +1102,7 @@ public TVAttribute (byte major, byte minor, byte subminor)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class WatchAttribute : IntroducedAttribute {
public WatchAttribute (byte major, byte minor)
: base (PlatformName.WatchOS, (int) major, (int) minor)
Expand All @@ -1113,6 +1115,7 @@ public WatchAttribute (byte major, byte minor, byte subminor)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class MacCatalystAttribute : IntroducedAttribute {
public MacCatalystAttribute (byte major, byte minor)
: base (PlatformName.MacCatalyst, (int) major, (int) minor)
Expand All @@ -1125,34 +1128,39 @@ public MacCatalystAttribute (byte major, byte minor, byte subminor)
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoMacAttribute : UnavailableAttribute {
public NoMacAttribute ()
: base (PlatformName.MacOSX)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoiOSAttribute : UnavailableAttribute {
public NoiOSAttribute ()
: base (PlatformName.iOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoWatchAttribute : UnavailableAttribute {
public NoWatchAttribute ()
: base (PlatformName.WatchOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoTVAttribute : UnavailableAttribute {
public NoTVAttribute ()
: base (PlatformName.TvOS)
{
}
}

[AttributeUsage (AttributeTargets.All, AllowMultiple = false)]
public sealed class NoMacCatalystAttribute : UnavailableAttribute {
public NoMacCatalystAttribute ()
: base (PlatformName.MacCatalyst)
Expand Down
4 changes: 2 additions & 2 deletions src/browserenginekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ interface NSObject_BEAccessibility
}

[BackingFieldType (typeof (ulong))]
[iOS (18, 0), TV (18, 0), MacCatalyst (18, 0), NoMac, MacCatalyst (18, 0)]
[iOS (18, 0), TV (18, 0), MacCatalyst (18, 0), NoMac]
public enum BEAccessibilityTrait : long {
[Field ("BEAccessibilityTraitMenuItem")]
MenuItem,
Expand All @@ -1214,7 +1214,7 @@ public enum BEAccessibilityTrait : long {
}

[BackingFieldType (typeof (uint))]
[iOS (18, 0), TV (18, 0), MacCatalyst (18, 0), NoMac, MacCatalyst (18, 0)]
[iOS (18, 0), TV (18, 0), MacCatalyst (18, 0), NoMac]
public enum BEAccessibilityNotification : long {
[Field ("BEAccessibilitySelectionChangedNotification")]
SelectionChanged,
Expand Down
2 changes: 1 addition & 1 deletion src/corelocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ interface CLLocationSourceInformation : NSCopying, NSSecureCoding {
bool IsProducedByAccessory { get; }
}

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0), TV (17, 0)]
[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
interface CLUpdate {
[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'Stationary' instead.")]
Expand Down
3 changes: 0 additions & 3 deletions src/coremotion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,17 +707,14 @@ interface CMTremorResult : NSCopying, NSSecureCoding {
float PercentStrong { get; }
}

[NoMac]
[Watch (5, 0), NoTV, NoMac, NoiOS]
[NoMacCatalyst]
delegate void CMDyskineticSymptomResultHandler (CMDyskineticSymptomResult [] dyskineticSymptomResult, NSError error);

[NoMac]
[Watch (5, 0), NoTV, NoMac, NoiOS]
[NoMacCatalyst]
delegate void CMTremorResultHandler (CMTremorResult [] tremorResults, NSError error);

[NoMac]
[Watch (5, 0), NoTV, NoMac, NoiOS]
[NoMacCatalyst]
[BaseType (typeof (NSObject))]
Expand Down
6 changes: 1 addition & 5 deletions src/mapkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2022,8 +2022,7 @@ partial interface MKPolylineRenderer {
nfloat StrokeEnd { get; set; }
}

[NoWatch]
[TV (14, 0), NoWatch, iOS (14, 0)]
[TV (14, 0), iOS (14, 0)]
[MacCatalyst (14, 0)]
[BaseType (typeof (MKPolylineRenderer))]
partial interface MKGradientPolylineRenderer {
Expand Down Expand Up @@ -2097,7 +2096,6 @@ partial interface MKTileOverlayRenderer {
void ReloadData ();
}

[NoWatch]
[NoWatch]
[MacCatalyst (13, 1)]
[BaseType (typeof (NSObject))]
Expand Down Expand Up @@ -2152,7 +2150,6 @@ interface MKLocalSearchCompleter {

interface IMKLocalSearchCompleterDelegate { }

[NoWatch]
[NoWatch]
[MacCatalyst (13, 1)]
[Protocol]
Expand All @@ -2166,7 +2163,6 @@ interface MKLocalSearchCompleterDelegate {
void DidFail (MKLocalSearchCompleter completer, NSError error);
}

[NoWatch]
[NoWatch]
[MacCatalyst (13, 1)]
[BaseType (typeof (NSObject))]
Expand Down
1 change: 0 additions & 1 deletion src/metal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5137,7 +5137,6 @@ interface MTLArgumentEncoder {
[Export ("setIntersectionFunctionTable:atIndex:")]
void SetIntersectionFunctionTable ([NullAllowed] IMTLIntersectionFunctionTable intersectionFunctionTable, nuint index);

[iOS (14, 0), TV (16, 0), MacCatalyst (14, 0)]
[Abstract (GenerateExtensionMethod = true)]
[Mac (11, 0), iOS (14, 0), TV (16, 0), MacCatalyst (14, 0)]
[Export ("setIntersectionFunctionTables:withRange:")]
Expand Down
1 change: 0 additions & 1 deletion src/networkextension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,6 @@ interface NETransparentProxyNetworkSettings {
NENetworkRule [] ExcludedNetworkRules { get; set; }
}

[NoTV]
[NoWatch, NoTV, NoMac, iOS (14, 0)]
[MacCatalyst (14, 0)]
[BaseType (typeof (NSObject))]
Expand Down
1 change: 0 additions & 1 deletion src/pdfkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,6 @@ interface PdfView :
[NoiOS]
[NoTV]
[NoMacCatalyst]
[NoTV]
interface PdfViewAnnotationHitEventArgs {
[Export ("PDFAnnotationHit")]
PdfAnnotation AnnotationHit { get; }
Expand Down
6 changes: 3 additions & 3 deletions src/social.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,19 @@ interface SLComposeServiceViewController : SocialTextViewDelegate {
#if NET
// Inlined manually from UITextViewDelegate/NSTextViewDelegate, because the one from the *Delegate type
// has different availability attributes depending on the platform.
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), MacCatalyst (18, 0), NoTV]
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), NoTV]
[Export ("textViewWritingToolsWillBegin:")]
new void WritingToolsWillBegin (SocialTextView textView);

// Inlined manually from UITextViewDelegate/NSTextViewDelegate, because the one from the *Delegate type
// has different availability attributes depending on the platform.
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), MacCatalyst (18, 0), NoTV]
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), NoTV]
[Export ("textViewWritingToolsDidEnd:")]
new void WritingToolsDidEnd (SocialTextView textView);

// Inlined manually from UITextViewDelegate/NSTextViewDelegate, because the one from the *Delegate type
// has different availability attributes depending on the platform.
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), MacCatalyst (18, 0), NoTV]
[iOS (18, 0), MacCatalyst (18, 0), Mac (15, 0), NoTV]
[Export ("textView:writingToolsIgnoredRangesInEnclosingRange:")]
new NSValue [] GetWritingToolsIgnoredRangesInEnclosingRange (SocialTextView textView, NSRange enclosingRange);
#endif
Expand Down
4 changes: 1 addition & 3 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21638,8 +21638,6 @@ interface UIGuidedAccessRestrictionDelegate {
}

[DisableDefaultCtor] // [Assert] -init is not a useful initializer for this class. Use one of the designated initializers instead
[NoWatch]
[NoWatch] // added in Xcode 7.1 / iOS 9.1 SDK
[MacCatalyst (13, 1)]
[BaseType (typeof (UIFocusUpdateContext))]
interface UICollectionViewFocusUpdateContext {
Expand Down Expand Up @@ -29446,7 +29444,7 @@ interface UITraitDisplayGamut : UINSIntegerTraitDefinition {
interface UITraitAccessibilityContrast : UINSIntegerTraitDefinition {
}

[NoWatch, TV (17, 0), NoWatch, iOS (17, 0), MacCatalyst (17, 0)]
[NoWatch, TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
interface UITraitUserInterfaceLevel : UINSIntegerTraitDefinition {
}
Expand Down

0 comments on commit 0937cff

Please sign in to comment.