diff mbox series

[meta-oe,2/2] oprofile: Do not use std::bind2nd

Message ID 20230207023819.2244963-2-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,1/2] ltrace: Fix build with clang16 | expand

Commit Message

Khem Raj Feb. 7, 2023, 2:38 a.m. UTC
std::bind2nd is removed from c++17, therefore re-implement with generic
lambda

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lace-std-bind2nd-with-generic-lambda.patch | 34 +++++++++++++++++++
 .../recipes-kernel/oprofile/oprofile_1.4.0.bb |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch b/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch
new file mode 100644
index 0000000000..930b90e289
--- /dev/null
+++ b/meta-oe/recipes-kernel/oprofile/oprofile/0001-Replace-std-bind2nd-with-generic-lambda.patch
@@ -0,0 +1,34 @@ 
+From 5d879cb4f23c613e16b3f479ab09bbb5ff340201 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 Feb 2023 17:02:41 -0800
+Subject: [PATCH] Replace std::bind2nd with generic lambda
+
+std::bind2nd is gone in c++17, therefore stop using it and replace it
+with generic lambda from c++14 onwards
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libutil++/growable_vector.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libutil++/growable_vector.h b/libutil++/growable_vector.h
+index 350246a..9846e1e 100644
+--- a/libutil++/growable_vector.h
++++ b/libutil++/growable_vector.h
+@@ -93,9 +93,9 @@ public:
+ 
+ 	/// return true if all elements have the default constructed value
+ 	bool zero() const {
+-		return std::find_if(container.begin(), container.end(),
+-	                            std::bind2nd(std::not_equal_to<T>(), T()))
+-					== container.end();
++		return std::find_if(begin(container), end(container),
++				[&](auto const& elem) {return elem != T();})
++			== end(container);
+ 	}
+ 
+ private:
+-- 
+2.39.1
+
diff --git a/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb b/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb
index e6eec0ab05..335ab48bb2 100644
--- a/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb
+++ b/meta-oe/recipes-kernel/oprofile/oprofile_1.4.0.bb
@@ -31,6 +31,7 @@  SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
            file://0009-Prevent-running-check-tests-on-host-if-cross-compili.patch \
            file://0010-oprofile-Determine-the-root-home-directory-dynamical.patch \
            file://0001-configure-Include-unistd.h-for-getpid-API.patch \
+           file://0001-Replace-std-bind2nd-with-generic-lambda.patch \
 "
 SRC_URI[sha256sum] = "7ba06f99d7c188389d20d1d5e53ee690c7733f87aa9af62bd664fa0ca235a412"