summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@amadeus.com>2017-06-18 15:16:16 +0200
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2017-07-08 16:22:27 -0700
commitc4de73c0e69b9a75b6795fdd4598234baed8496d (patch)
tree927ed4c800b87d630591a358fb21b9d156df4151
parente5fbd0e24e19bf3c9a8777cfc78e6188c5557025 (diff)
downloadgperftools-c4de73c0e69b9a75b6795fdd4598234baed8496d.tar.gz
Add PERFTOOLS_THROW where necessary (as detected by GCC).
-rw-r--r--src/base/basictypes.h7
-rw-r--r--src/libc_override_gcc_and_weak.h4
-rw-r--r--src/tests/tcmalloc_unittest.cc2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/base/basictypes.h b/src/base/basictypes.h
index 42dbe5c..a22bd9a 100644
--- a/src/base/basictypes.h
+++ b/src/base/basictypes.h
@@ -433,4 +433,11 @@ namespace base {
enum LinkerInitialized { LINKER_INITIALIZED };
}
+#if __cpp_noexcept_function_type >= 201510
+// Deprecated in C++17
+# define PERFTOOLS_THROW(...)
+#else
+# define PERFTOOLS_THROW(...) throw(__VA_ARGS__)
+#endif
+
#endif // _BASICTYPES_H_
diff --git a/src/libc_override_gcc_and_weak.h b/src/libc_override_gcc_and_weak.h
index ecb66ec..8b1e56a 100644
--- a/src/libc_override_gcc_and_weak.h
+++ b/src/libc_override_gcc_and_weak.h
@@ -57,11 +57,11 @@
#define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn), used))
-void* operator new(size_t size) throw (std::bad_alloc)
+void* operator new(size_t size) PERFTOOLS_THROW(std::bad_alloc)
ALIAS(tc_new);
void operator delete(void* p) throw()
ALIAS(tc_delete);
-void* operator new[](size_t size) throw (std::bad_alloc)
+void* operator new[](size_t size) PERFTOOLS_THROW(std::bad_alloc)
ALIAS(tc_newarray);
void operator delete[](void* p) throw()
ALIAS(tc_deletearray);
diff --git a/src/tests/tcmalloc_unittest.cc b/src/tests/tcmalloc_unittest.cc
index 987ae10..3354028 100644
--- a/src/tests/tcmalloc_unittest.cc
+++ b/src/tests/tcmalloc_unittest.cc
@@ -627,7 +627,7 @@ static void TestRealloc() {
#endif
}
-static void TestNewHandler() throw (std::bad_alloc) {
+static void TestNewHandler() PERFTOOLS_THROW(std::bad_alloc) {
++news_handled;
throw std::bad_alloc();
}