]> granicus.if.org Git - clang/commitdiff
For the availability attribute, allow a declaration to be deprecated
authorDouglas Gregor <dgregor@apple.com>
Wed, 10 Aug 2011 15:31:35 +0000 (15:31 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 10 Aug 2011 15:31:35 +0000 (15:31 +0000)
in the same version that it is introduced. Stuff happens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137214 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/attr-availability.c

index 0644103b44e118996dcabbe4320b506be55a6847..419adefa12923436a999a6feb1c58f003731f97d 100644 (file)
@@ -1507,7 +1507,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
   // Ensure that Introduced < Deprecated < Obsoleted (although not all
   // of these steps are needed).
   if (Introduced.isValid() && Deprecated.isValid() &&
-      !(Introduced.Version < Deprecated.Version)) {
+      !(Introduced.Version <= Deprecated.Version)) {
     S.Diag(Introduced.KeywordLoc, diag::warn_availability_version_ordering)
       << 1 << PlatformName << Deprecated.Version.getAsString()
       << 0 << Introduced.Version.getAsString();
@@ -1515,7 +1515,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
   }
 
   if (Introduced.isValid() && Obsoleted.isValid() &&
-      !(Introduced.Version < Obsoleted.Version)) {
+      !(Introduced.Version <= Obsoleted.Version)) {
     S.Diag(Introduced.KeywordLoc, diag::warn_availability_version_ordering)
       << 2 << PlatformName << Obsoleted.Version.getAsString()
       << 0 << Introduced.Version.getAsString();
@@ -1523,7 +1523,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,
   }
 
   if (Deprecated.isValid() && Obsoleted.isValid() &&
-      !(Deprecated.Version < Obsoleted.Version)) {
+      !(Deprecated.Version <= Obsoleted.Version)) {
     S.Diag(Deprecated.KeywordLoc, diag::warn_availability_version_ordering)
       << 2 << PlatformName << Obsoleted.Version.getAsString()
       << 1 << Deprecated.Version.getAsString();
index 1314cf5a5b032308906ffbe2c6b3d840b910b469..f6ed13190ed818db72a14f77e0fe5ec714564969 100644 (file)
@@ -2,5 +2,6 @@
 
 void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
 void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0)));  // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}
+void f2() __attribute__((availability(ios,introduced=2.1,deprecated=2.1)));
 
-void f2() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}}
+void f3() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}}