For the availability attribute, allow a declaration to be deprecated

in the same version that it is introduced. Stuff happens.

llvm-svn: 137214
This commit is contained in:
Douglas Gregor 2011-08-10 15:31:35 +00:00
parent 6680421015
commit 6f47e5cabf
2 changed files with 5 additions and 4 deletions

View 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();

View 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}}