From b5e8348bf2ded134e45dab879a13d26f5b9c5815 Mon Sep 17 00:00:00 2001 From: Haowei Wu Date: Mon, 11 Oct 2021 17:32:38 -0700 Subject: [PATCH] Revert "[clang][Fuchsia] Support availability attr on Fuchsia" This reverts commit 1131b1eb3509b47d30a36ea9b42367ab1d7373a2, which breaks several llvm bots. --- clang/include/clang/Basic/Attr.td | 1 - clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 -- clang/include/clang/Basic/LangOptions.def | 2 -- clang/include/clang/Driver/Options.td | 3 -- clang/lib/Basic/Targets/OSTargets.h | 3 -- clang/lib/Driver/ToolChains/Clang.cpp | 3 -- clang/lib/Sema/SemaDeclAttr.cpp | 9 ----- clang/test/Driver/attr-availability-fuchsia.c | 45 ------------------------ clang/test/Sema/attr-availability-fuchsia.c | 24 ------------- 9 files changed, 93 deletions(-) delete mode 100644 clang/test/Driver/attr-availability-fuchsia.c delete mode 100644 clang/test/Sema/attr-availability-fuchsia.c diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index c39657e..2266965 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -848,7 +848,6 @@ def Availability : InheritableAttr { [{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) { return llvm::StringSwitch(Platform) .Case("android", "Android") - .Case("fuchsia", "Fuchsia") .Case("ios", "iOS") .Case("macos", "macOS") .Case("tvos", "tvOS") diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index c5b3f2c..128ad04 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3554,9 +3554,6 @@ def warn_availability_swift_unavailable_deprecated_only : Warning< InGroup; def note_protocol_method : Note< "protocol method is here">; -def warn_availability_fuchsia_unavailable_minor : Warning< - "Fuchsia API Level prohibits specifying a minor or sub-minor version">, - InGroup; def warn_unguarded_availability : Warning<"%0 is only available on %1 %2 or newer">, diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 912fd0e..e21d2fc 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -431,8 +431,6 @@ ENUM_LANGOPT(ExtendIntArgs, ExtendArgsKind, 1, ExtendArgsKind::ExtendTo32, "Controls how scalar integer arguments are extended in calls " "to unprototyped and varargs functions") -VALUE_LANGOPT(FuchsiaAPILevel, 32, 0, "Fuchsia API level") - #undef LANGOPT #undef COMPATIBLE_LANGOPT #undef BENIGN_LANGOPT diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 4d422ab..9b0d0df 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3173,9 +3173,6 @@ def mlinker_version_EQ : Joined<["-"], "mlinker-version=">, def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>, HelpText<"Additional arguments to forward to LLVM's option processing">, MarshallingInfoStringVector>; -def ffuchsia_api_level_EQ : Joined<["-"], "ffuchsia-api-level=">, - Group, Flags<[CC1Option]>, HelpText<"Set Fuchsia API level">, - MarshallingInfoInt>; def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">, Group, HelpText<"Set Mac OS X deployment target">; def mmacos_version_min_EQ : Joined<["-"], "mmacos-version-min=">, diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 220290c..02a0957 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -890,9 +890,6 @@ protected: // Required by the libc++ locale support. if (Opts.CPlusPlus) Builder.defineMacro("_GNU_SOURCE"); - Builder.defineMacro("__Fuchsia_API_level__", Twine(Opts.FuchsiaAPILevel)); - this->PlatformName = "fuchsia"; - this->PlatformMinVersion = VersionTuple(Opts.FuchsiaAPILevel); } public: diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7ce6aa2..f1771d4 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5481,9 +5481,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_fexperimental_relative_cxx_abi_vtables, options::OPT_fno_experimental_relative_cxx_abi_vtables); - if (Arg *A = Args.getLastArg(options::OPT_ffuchsia_api_level_EQ)) - A->render(Args, CmdArgs); - // Handle -{std, ansi, trigraphs} -- take the last of -{std, ansi} // (-ansi is equivalent to -std=c89 or -std=c++98). // diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index d49ff4b..07e8090 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2496,15 +2496,6 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } } - if (II->isStr("fuchsia")) { - Optional Min, Sub; - if ((Min = Introduced.Version.getMinor()) || - (Sub = Introduced.Version.getSubminor())) { - S.Diag(AL.getLoc(), diag::warn_availability_fuchsia_unavailable_minor); - return; - } - } - int PriorityModifier = AL.isPragmaClangAttribute() ? Sema::AP_PragmaClangAttribute : Sema::AP_Explicit; diff --git a/clang/test/Driver/attr-availability-fuchsia.c b/clang/test/Driver/attr-availability-fuchsia.c deleted file mode 100644 index 5d2b414..0000000 --- a/clang/test/Driver/attr-availability-fuchsia.c +++ /dev/null @@ -1,45 +0,0 @@ -// Test that `-ffuchsia-api-level` is propagated to cc1. -// RUN: %clang -target x86_64-unknown-fuchsia -ffuchsia-api-level=16 -c %s -### 2>&1| FileCheck %s - -// It should also be exposed to non-fuchsia platforms. This is desireable when -// using common Fuchsia headers for building host libraries that also depend on -// the Fuchsia version (such as using a compatible host-side FIDL library that -// talks with a Fuchsia FIDL library of the same version). -// RUN: %clang -target x86_64-unknown-linux-gnu -ffuchsia-api-level=16 -c %s -### 2>&1 | FileCheck %s - -// Check Fuchsia API level macro. -// RUN: %clang -target x86_64-unknown-fuchsia -ffuchsia-api-level=15 -c %s -o %t -// RUN: llvm-readobj --symbols %t | FileCheck %s --check-prefix=CHECK-F15 -// -// RUN: %clang -target x86_64-unknown-fuchsia -ffuchsia-api-level=16 -c %s -o %t -// RUN: llvm-readobj --symbols %t | FileCheck %s --check-prefix=CHECK-F16 - -// Check using a non-integer Fuchsia API level. -// RUN: not %clang -target x86_64-unknown-fuchsia -ffuchsia-api-level=16.0.0 -c %s 2>&1| FileCheck %s --check-prefix=CHECK-ERROR - - -// CHECK: "-ffuchsia-api-level=16" - -// CHECK-F15: Name: f15 - -// CHECK-F16: Name: f16 - -// CHECK-ERROR: error: invalid integral value '16.0.0' in '-ffuchsia-api-level=16.0.0' - -#if __Fuchsia_API_level__ >= 16 -void f16() { - -} -#else -void f15() { - -} -#endif - -int main(int argc, char* argv[]) { -#if __Fuchsia_API_level__ >= 16 - f16(); -#else - f15(); -#endif -} diff --git a/clang/test/Sema/attr-availability-fuchsia.c b/clang/test/Sema/attr-availability-fuchsia.c deleted file mode 100644 index b618697..0000000 --- a/clang/test/Sema/attr-availability-fuchsia.c +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: %clang_cc1 "-triple" "x86_64-unknown-fuchsia" -ffuchsia-api-level=16 -fsyntax-only -verify %s -// RUN: %clang_cc1 "-triple" "x86_64-unknown-fuchsia" -fsyntax-only %s 2>&1 | FileCheck %s - -// If the version is not specified, we should not get any errors since there -// is no checking (the major version number is zero). -// CHECK-NOT: error: - -void f0(int) __attribute__((availability(fuchsia, introduced = 14, deprecated = 19))); -void f1(int) __attribute__((availability(fuchsia, introduced = 16))); -void f2(int) __attribute__((availability(fuchsia, introduced = 14, deprecated = 16))); // expected-note {{'f2' has been explicitly marked deprecated here}} -void f3(int) __attribute__((availability(fuchsia, introduced = 19))); -void f4(int) __attribute__((availability(fuchsia, introduced = 9, deprecated = 11, obsoleted = 16), availability(ios, introduced = 2.0, deprecated = 3.0))); // expected-note{{explicitly marked unavailable}} -void f5(int) __attribute__((availability(ios, introduced = 3.2), availability(fuchsia, unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}} -void f6(int) __attribute__((availability(fuchsia, introduced = 16.0))); // expected-warning {{Fuchsia API Level prohibits specifying a minor or sub-minor version}} -void f7(int) __attribute__((availability(fuchsia, introduced = 16.1))); // expected-warning {{Fuchsia API Level prohibits specifying a minor or sub-minor version}} - -void test() { - f0(0); - f1(0); - f2(0); // expected-warning{{'f2' is deprecated: first deprecated in Fuchsia 16}} - f3(0); - f4(0); // expected-error{{f4' is unavailable: obsoleted in Fuchsia 16}} - f5(0); // expected-error{{'f5' is unavailable: not available on Fuchsia}} -} -- 2.7.4