Projects
Mega:24.03:SP1:Everything
clang
_service:tar_scm:0004-add-gcc-compatible-in-BUI...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0004-add-gcc-compatible-in-BUILD_FOR_OPENEULER.patch of Package clang
From 6503d6b87786e005c0557961aadba739d833f80c Mon Sep 17 00:00:00 2001 From: liyunfei <liyunfei33@huawei.com> Date: Tue, 16 Jan 2024 14:48:53 +0800 Subject: [PATCH] add gcc compatible in BUILD_FOR_OPENEULER --- clang/include/clang/Driver/Options.td | 14 ++++++++++++++ clang/lib/Driver/Driver.cpp | 8 ++++++++ clang/lib/Driver/ToolChains/Clang.cpp | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 37e8c56b2d29..d4f7315bf8cb 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1786,6 +1786,12 @@ def fmemory_profile_use_EQ : Joined<["-"], "fmemory-profile-use=">, HelpText<"Use memory profile for profile-guided memory optimization">, MarshallingInfoString<CodeGenOpts<"MemoryProfileUsePath">>; +#ifdef BUILD_FOR_OPENEULER +def fgcc_compatible : Flag<["-"], "fgcc-compatible">, Group<f_Group>, + HelpText<"Enable gcc compatibility for openEuler.">; +def fno_gcc_compatible : Flag<["-"], "fno-gcc-compatible">, Group<f_Group>; +#endif + // Begin sanitizer flags. These should all be core options exposed in all driver // modes. let Flags = [CC1Option, CoreOption] in { @@ -5152,6 +5158,14 @@ def falign_jumps_EQ : Joined<["-"], "falign-jumps=">, Group<clang_ignored_gcc_op // ignore it for now to avoid breaking builds that use it. def fdiagnostics_show_location_EQ : Joined<["-"], "fdiagnostics-show-location=">, Group<clang_ignored_f_Group>; +#ifdef BUILD_FOR_OPENEULER +def flifetime_dse_EQ : Joined<["-"], "flifetime-dse=">, Group<clang_ignored_gcc_optimization_f_Group>; +defm peephole : BooleanFFlag<"peephole">, Group<clang_ignored_gcc_optimization_f_Group>; +defm peephole2 : BooleanFFlag<"peephole2">, Group<clang_ignored_gcc_optimization_f_Group>; +defm aggressive_loop_optiomizations : BooleanFFlag<"aggressive-loop-optiomizations">, Group<clang_ignored_gcc_optimization_f_Group>; +def flto_partition_EQ : Joined<["-"], "flto-partition=">, Group<clang_ignored_gcc_optimization_f_Group>; +#endif + defm check_new : BoolOption<"f", "check-new", LangOpts<"CheckNew">, DefaultFalse, PosFlag<SetTrue, [], "Do not assume C++ operator new may not return NULL">, diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index bdbdad9362e1..87736112fb76 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1491,6 +1491,14 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) { // Populate the tool chains for the offloading devices, if any. CreateOffloadingDeviceToolChains(*C, Inputs); +#ifdef BUILD_FOR_OPENEULER + if(C->getArgs().hasFlag(options::OPT_fgcc_compatible, + options::OPT_fno_gcc_compatible, false)) { + getDiags().setDiagnosticGroupWarningAsError("unused-command-line-argument", 0); + getDiags().setDiagnosticGroupWarningAsError("ignored-optimization-argument", 0); + } +#endif + // Construct the list of abstract actions to perform for this compilation. On // MachO targets this uses the driver-driver and universal actions. if (TC.getTriple().isOSBinFormatMachO()) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 37a07b8f224d..0921e6071d26 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4680,6 +4680,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-triple"); CmdArgs.push_back(Args.MakeArgString(TripleStr)); +#ifdef BUILD_FOR_OPENEULER + if (Args.hasFlag(options::OPT_fgcc_compatible, + options::OPT_fno_gcc_compatible, false)) { + CmdArgs.push_back("-Wno-error=unknown-warning-option"); + CmdArgs.push_back("-Wno-error=unused-parameter"); + CmdArgs.push_back("-Wno-error=unused-function"); + CmdArgs.push_back("-Wno-error=unused-but-set-parameter"); + CmdArgs.push_back("-Wno-error=unused-but-set-variable"); + } +#endif + if (const Arg *MJ = Args.getLastArg(options::OPT_MJ)) { DumpCompilationDatabase(C, MJ->getValue(), TripleStr, Output, Input, Args); Args.ClaimAllArgs(options::OPT_MJ); -- Gitee
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2