SHA256
1
0
forked from pool/systemtap
systemtap/gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch
Tony Jones d090c61581 Accepting request 958520 from home:jones_tony:branches:devel:tools
- Add gcc12 support (bsc#1196583)
    New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch
    New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch
    New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch
    New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch
    New patch: gcc12-warning-suppression.patch
- Add gcc12 support (bsc#1196583)
    New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch
    New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch
    New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch
    New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch
    New patch: gcc12-warning-suppression.patch
- Add gcc12 support (bsc#1196583)
    New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch
    New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch
    New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch
    New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch
    New patch: gcc12-warning-suppression.patch

OBS-URL: https://build.opensuse.org/request/show/958520
OBS-URL: https://build.opensuse.org/package/show/devel:tools/systemtap?expand=0&rev=134
2022-03-02 19:46:23 +00:00

54 lines
1.5 KiB
Diff

From: Serhei Makarov <serhei@serhei.io>
Date: Fri, 21 Jan 2022 18:21:46 -0500
Subject: gcc12 c++ compatibility re-tweak for rhel6: use function pointer
instead of lambdas instead of ptr_fun<>
Git-repo: git://sourceware.org/git/systemtap.git
Git-commit: f199d1982ef8a6c6d5c06c082d057b8793bcc6aa
References: bsc#1196583
Saving 2 lines in ltrim/rtrim is probably not a good reason to drop
compatibility with the RHEL6 system compiler. Actually declaring a
named function and passing the function pointer is compatible with
everything.
Signed-off-by: Tony Jones <tonyj@suse.de>
---
util.cxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/util.cxx b/util.cxx
index e9286eca3..ad36259c9 100644
--- a/util.cxx
+++ b/util.cxx
@@ -1757,21 +1757,24 @@ flush_to_stream (const string &fname, ostream &o)
return 1; // Failure
}
+int
+not_isspace(unsigned char c)
+{
+ return !std::isspace(c);
+}
+
// trim from start (in place)
void
ltrim(std::string &s)
{
- s.erase(s.begin(),
- std::find_if(s.begin(), s.end(),
- [](unsigned char c) { return !std::isspace(c); }));
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_isspace));
}
// trim from end (in place)
void
rtrim(std::string &s)
{
- s.erase(std::find_if(s.rbegin(), s.rend(),
- [](unsigned char c) { return !std::isspace(c); }).base(), s.end());
+ s.erase(std::find_if(s.rbegin(), s.rend(), not_isspace).base(), s.end());
}
// trim from both ends (in place)