summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-05-01 15:42:57 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2024-05-01 15:46:52 +0200
commiteda76b336b6b6719434fd7cc314ba51fa18eda5c (patch)
tree44fa844fb80ecffe8554bfdcdd89b1d02b4ee2c8
parent507f9439e7b930cfd8033dbfeaf3fe7df2e9dfd3 (diff)
downloadopenwrt-23.05.tar.gz
openwrt-23.05.tar.bz2
openwrt-23.05.zip
gengetopt: backport patch fixing support for c++17openwrt-23.05
Backport patch fixing support for c++17 that got merged upstream in gengetopt. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit a8bfdf2ed4d930ca5a31b5c4bc7061ad5ef11ba3)
-rw-r--r--tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch25
-rw-r--r--tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch33
2 files changed, 58 insertions, 0 deletions
diff --git a/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch b/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch
new file mode 100644
index 0000000000..6aa3f549da
--- /dev/null
+++ b/tools/gengetopt/patches/001-gm_utils.cpp-Call-clear-instead-of-empty.patch
@@ -0,0 +1,25 @@
+From bfba6445a778007f40af5cbfbe725e12c0fcafc6 Mon Sep 17 00:00:00 2001
+From: Tomas Volf <~@wolfsden.cz>
+Date: Tue, 5 Mar 2024 22:25:20 +0100
+Subject: [PATCH] gm_utils.cpp: Call clear instead of empty.
+
+Since the intention seem to be to erase the next word, I believe calling empty
+was a mistake and it should have been clear. Empty does nothing in this
+context.
+
+* src/gm_utils.cpp (wrap_cstr): Call clear.
+---
+ src/gm_utils.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/gm_utils.cpp
++++ b/src/gm_utils.cpp
+@@ -311,7 +311,7 @@ void wrap_cstr(string& wrapped, unsigned
+ // trim leading spaces
+ std::size_t pos = next_word.find_first_not_of(' ');
+ if( pos == std::string::npos )
+- next_word.empty();
++ next_word.clear();
+ else if( pos )
+ next_word.erase( 0, pos );
+
diff --git a/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch b/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch
new file mode 100644
index 0000000000..ce997f4505
--- /dev/null
+++ b/tools/gengetopt/patches/002-gm_utils.h-Drop-std-unary_function.patch
@@ -0,0 +1,33 @@
+From a3d0a0419a35bef9b80a6a12432ab30e2d1e0f5a Mon Sep 17 00:00:00 2001
+From: Tomas Volf <~@wolfsden.cz>
+Date: Tue, 5 Mar 2024 22:27:42 +0100
+Subject: [PATCH] gm_utils.h: Drop std::unary_function.
+
+I am not sure what it does, it is deprecated/removed (depending on C++ version)
+and the advice seems to be that is just is not necessary. So just remove it.
+
+* src/gm_utils.h (print_f, pair_print_f): Drop std::unary_function.
+---
+ src/gm_utils.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/gm_utils.h
++++ b/src/gm_utils.h
+@@ -117,7 +117,7 @@ bool string_contains(const char *s, cons
+ * Function object to print something into a stream (to be used with for_each)
+ */
+ template<class T>
+-struct print_f : public std::unary_function<T, void>
++struct print_f
+ {
+ print_f(std::ostream& out, const string &s = ", ") : os(out), sep(s) {}
+ void operator() (T x) { os << x << sep; }
+@@ -129,7 +129,7 @@ struct print_f : public std::unary_funct
+ * Function object to print a pair into two streams (to be used with for_each)
+ */
+ template<class T>
+-struct pair_print_f : public std::unary_function<T, void>
++struct pair_print_f
+ {
+ pair_print_f(std::ostream& out1, std::ostream& out2, const string &s = ", ") :
+ os1(out1), os2(out2), sep(s) {}