warning fix: std::iterator is deprecated

Signed-off-by: WizardHowl <liuwenyu7@huawei.com>
This commit is contained in:
WizardHowl 2023-08-09 02:39:23 +00:00 committed by Wenyu Liu
parent e342254af7
commit 41fe9a43a6
3 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,34 @@
From 55d8a338e362d3aa4448aa9bae776eb90ca1292a Mon Sep 17 00:00:00 2001
From: "James A. Kupsch" <kupsch@cs.wisc.edu>
Date: Thu, 16 Feb 2023 10:11:59 -0600
Subject: [PATCH] warning fix: std::iterator is deprecated (#1394)
- replace std::iterator with in class type aliass for required types
---
symtabAPI/h/Symtab.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/symtabAPI/h/Symtab.h b/symtabAPI/h/Symtab.h
index 7731c1572..bf6d8ab23 100644
--- a/symtabAPI/h/Symtab.h
+++ b/symtabAPI/h/Symtab.h
@@ -558,9 +558,15 @@ class SYMTAB_EXPORT Symtab : public LookupInterface,
void erase(Symbol* s);
// Iterator for the symbols. Do not use in parallel.
- class iterator : public std::iterator<std::forward_iterator_tag,Symbol*> {
+ class iterator {
master_t::iterator m;
public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = Symbol*;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+
iterator(master_t::iterator i) : m(i) {}
bool operator==(const iterator& x) { return m == x.m; }
bool operator!=(const iterator& x) { return !operator==(x); }
--
2.21.0.windows.1

View File

@ -1,6 +1,6 @@
Name: dyninst
License: LGPLv2+
Release: 2
Release: 3
Version: 12.3.0
Summary: An API for Run-time Code Generation
ExclusiveArch: x86_64 aarch64
@ -13,7 +13,8 @@ URL: http://www.dyninst.org
Source0: https://github.com/dyninst/dyninst/archive/v%{version}/dyninst-%{version}.tar.gz
Source1: https://github.com/dyninst/testsuite/archive/v%{testsuite_version}/%{testsuite_base}.tar.gz
Patch1: 0001-eliminate-deprecated-C-function-objects-1331.patch
Patch1: dyninst-eliminate-deprecated-C-function-objects-1331.patch
Patch2: dyninst-warning-fix-std-iterator-is-deprecated-1394.patch
BuildRequires: cmake gcc-c++
BuildRequires: binutils-devel boost-devel
@ -52,6 +53,7 @@ dyninst-doc contains API documentation for the Dyninst libraries.
pushd %{dyninst_base}
%patch 1 -p1
%patch 2 -p1
popd
sed -i.cotire -e 's/USE_COTIRE true/USE_COTIRE false/' \
@ -123,6 +125,9 @@ echo "%{_libdir}/dyninst" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf
%doc %{dyninst_base}/symtabAPI/doc/symtabAPI.pdf
%changelog
* Wed Aug 9 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.3.0-3
- warning fix: std::iterator is deprecated
* Thu Jul 20 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.3.0-2
- eliminate deprecated C++ function objects