Fix LLVM 19 build
Resolves: RHEL-64925 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
parent
a334e08e92
commit
fd07f2481a
@ -0,0 +1,116 @@
|
|||||||
|
From 28a3b307bb3f11b72a6bd3f9313d7725bdf0d7ac Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rong Tao <rongtao@cestc.cn>
|
||||||
|
Date: Sun, 19 May 2024 13:15:03 +0800
|
||||||
|
Subject: [PATCH] Fix: startswith() is deprecated: Use starts_with instead
|
||||||
|
(#5002)
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
llvm [0] startswith() is deprecated in commit 5ac12951b4e9 ("[ADT] Deprecate
|
||||||
|
StringRef::{starts,ends}with (#75491)"), and it's totally removed in
|
||||||
|
commit 4ec9a662d388 ("[ADT] Remove StringRef::{startswith,endswith} (#89548)").
|
||||||
|
|
||||||
|
Warning detail:
|
||||||
|
|
||||||
|
$ make
|
||||||
|
[...]
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:341:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||||
|
341 | if (!A->getName().startswith("maps"))
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||||
|
In file included from /usr/include/clang/Basic/DiagnosticIDs.h:19,
|
||||||
|
from /usr/include/clang/Basic/Diagnostic.h:17,
|
||||||
|
from /usr/include/clang/AST/NestedNameSpecifier.h:18,
|
||||||
|
from /usr/include/clang/AST/Type.h:21,
|
||||||
|
from /usr/include/clang/AST/CanonicalType.h:17,
|
||||||
|
from /usr/include/clang/AST/ASTContext.h:18,
|
||||||
|
from /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:23:
|
||||||
|
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||||
|
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::ProbeVisitor::assignsExtPtr(clang::Expr*, int*)’:
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:393:39: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||||
|
393 | if (!A->getName().startswith("maps"))
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||||
|
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||||
|
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitCallExpr(clang::CallExpr*)’:
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:940:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||||
|
940 | if (!A->getName().startswith("maps"))
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||||
|
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||||
|
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
|
||||||
|
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:1458:33: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||||
|
1458 | if (!A->getName().startswith("maps"))
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||||
|
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||||
|
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||||
|
| ^~~~~~~~~~
|
||||||
|
[ 73%] Built target clang_frontend-objects
|
||||||
|
|
||||||
|
[0] https://github.com/llvm/llvm-project
|
||||||
|
|
||||||
|
Signed-off-by: Xue Yuehua <2482887395@qq.com>
|
||||||
|
Signed-off-by: Rong Tao <rongtao@cestc.cn>
|
||||||
|
---
|
||||||
|
src/cc/frontends/clang/b_frontend_action.cc | 16 ++++++++++++++++
|
||||||
|
1 file changed, 16 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc
|
||||||
|
index 10d64fdc..95cec3cb 100644
|
||||||
|
--- a/src/cc/frontends/clang/b_frontend_action.cc
|
||||||
|
+++ b/src/cc/frontends/clang/b_frontend_action.cc
|
||||||
|
@@ -338,7 +338,11 @@ bool MapVisitor::VisitCallExpr(CallExpr *Call) {
|
||||||
|
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||||
|
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||||
|
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||||
|
+#if LLVM_VERSION_MAJOR < 18
|
||||||
|
if (!A->getName().startswith("maps"))
|
||||||
|
+#else
|
||||||
|
+ if (!A->getName().starts_with("maps"))
|
||||||
|
+#endif
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (memb_name == "update" || memb_name == "insert") {
|
||||||
|
@@ -390,7 +394,11 @@ bool ProbeVisitor::assignsExtPtr(Expr *E, int *nbDerefs) {
|
||||||
|
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||||
|
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||||
|
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||||
|
+#if LLVM_VERSION_MAJOR < 18
|
||||||
|
if (!A->getName().startswith("maps"))
|
||||||
|
+#else
|
||||||
|
+ if (!A->getName().starts_with("maps"))
|
||||||
|
+#endif
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (memb_name == "lookup" || memb_name == "lookup_or_init" ||
|
||||||
|
@@ -937,7 +945,11 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
|
||||||
|
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||||
|
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||||
|
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||||
|
+#if LLVM_VERSION_MAJOR < 18
|
||||||
|
if (!A->getName().startswith("maps"))
|
||||||
|
+#else
|
||||||
|
+ if (!A->getName().starts_with("maps"))
|
||||||
|
+#endif
|
||||||
|
return true;
|
||||||
|
|
||||||
|
string args = rewriter_.getRewrittenText(expansionRange(SourceRange(GET_BEGINLOC(Call->getArg(0)),
|
||||||
|
@@ -1455,7 +1467,11 @@ int64_t BTypeVisitor::getFieldValue(VarDecl *Decl, FieldDecl *FDecl, int64_t Ori
|
||||||
|
bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
|
||||||
|
const RecordType *R = Decl->getType()->getAs<RecordType>();
|
||||||
|
if (SectionAttr *A = Decl->getAttr<SectionAttr>()) {
|
||||||
|
+#if LLVM_VERSION_MAJOR < 18
|
||||||
|
if (!A->getName().startswith("maps"))
|
||||||
|
+#else
|
||||||
|
+ if (!A->getName().starts_with("maps"))
|
||||||
|
+#endif
|
||||||
|
return true;
|
||||||
|
if (!R) {
|
||||||
|
error(GET_ENDLOC(Decl), "invalid type for bpf_table, expect struct");
|
||||||
|
--
|
||||||
|
2.47.0
|
||||||
|
|
6
bcc.spec
6
bcc.spec
@ -25,13 +25,14 @@
|
|||||||
|
|
||||||
Name: bcc
|
Name: bcc
|
||||||
Version: 0.30.0
|
Version: 0.30.0
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: BPF Compiler Collection (BCC)
|
Summary: BPF Compiler Collection (BCC)
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
URL: https://github.com/iovisor/bcc
|
URL: https://github.com/iovisor/bcc
|
||||||
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
Patch0: %%{name}-%%{version}-clang-fail-when-the-kheaders-ownership-is-wrong-4928.patch
|
Patch0: %%{name}-%%{version}-clang-fail-when-the-kheaders-ownership-is-wrong-4928.patch
|
||||||
Patch1: %%{name}-%%{version}-Revert-Fix-bashreadline-4903.patch
|
Patch1: %%{name}-%%{version}-Revert-Fix-bashreadline-4903.patch
|
||||||
|
Patch2: %%{name}-%%{version}-Fix-startswith-is-deprecated-Use-starts_with-instead.patch
|
||||||
|
|
||||||
# Arches will be included as upstream support is added and dependencies are
|
# Arches will be included as upstream support is added and dependencies are
|
||||||
# satisfied in the respective arches
|
# satisfied in the respective arches
|
||||||
@ -262,6 +263,9 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 29 2024 Jerome Marchand <jmarchan@redhat.com> - 0.30.0-4
|
||||||
|
- Fix LLVM 19 build (RHEL-64925)
|
||||||
|
|
||||||
* Fri Oct 04 2024 Jerome Marchand <jmarchan@redhat.com> - 0.30.0-3
|
* Fri Oct 04 2024 Jerome Marchand <jmarchan@redhat.com> - 0.30.0-3
|
||||||
- Remove python3-pyelftools dependency (RHEL-60064)
|
- Remove python3-pyelftools dependency (RHEL-60064)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user