[PATCH 2/3] Fix OProfile libabi issues reported by GCC 7

William Cohen <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
GCC 7 uses the C++11 standards and dynamic exception specification are
deprecated.  Spelling out what exception the method throws would cause
GCC 7 to warn about this deprecated use and the make compiler setting
woudl cause the build to fail on the warning.

Also needed to explicitly pass in a couple parameters for the abi need
method as strings rather than char * pointers to get the code to
compile with GCC 7.

Signed-off-by: William Cohen <[email protected]>
---
 libabi/abi.cpp      | 2 +-
 libabi/abi.h        | 2 +-
 libabi/opimport.cpp | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libabi/abi.cpp b/libabi/abi.cpp
index 04a6b2d..607c7bf 100644
--- a/libabi/abi.cpp
+++ b/libabi/abi.cpp
@@ -35,7 +35,7 @@ abi::abi()
 }
 
 
-int abi::need(string const key) const throw (abi_exception)
+int abi::need(string const key) const
 {
 	if (slots.find(key) != slots.end())
 		return slots.find(key)->second;
diff --git a/libabi/abi.h b/libabi/abi.h
index 8b63e7f..4552160 100644
--- a/libabi/abi.h
+++ b/libabi/abi.h
@@ -29,7 +29,7 @@ class abi {
 public:
 	abi();
 
-	int need(std::string const key) const throw (abi_exception);
+	int need(std::string const key) const;
 
 	bool operator==(abi const & other) const;
 	friend std::ostream & operator<<(std::ostream & o, abi const & abi);
diff --git a/libabi/opimport.cpp b/libabi/opimport.cpp
index c2234fe..44084ae 100644
--- a/libabi/opimport.cpp
+++ b/libabi/opimport.cpp
@@ -77,8 +77,8 @@ void extractor::extract(T & targ, void const * src_,
                         char const * sz, char const * off)
 {
 	unsigned char const * src = static_cast<unsigned char const *>(src_)
-		+ theabi.need(off);
-	size_t nbytes = theabi.need(sz);
+		+ theabi.need(string(off));
+	size_t nbytes = theabi.need(string(sz));
 
 	targ = 0;
 	if (nbytes == 0)
@@ -109,7 +109,7 @@ void extractor::extract(T & targ, void const * src_,
 
 
 void import_from_abi(abi const & abi, void const * srcv,
-                     size_t len, odb_t * dest) throw (abi_exception)
+                     size_t len, odb_t * dest)
 {
 	struct opd_header * head =
 		static_cast<opd_header *>(odb_get_data(dest));
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.