From 8b310cc05db54ac80d6600da31ea6a45e8f50510 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Wed, 23 Oct 2019 00:47:13 +0200
Subject: [PATCH] fix(build): Ignore noexcept-type for malloc_ptr_t
Since all of polybar is built at once, there is no chance that this is
ever linked to an object that was compiled with another `-std=`
Ref: https://stackoverflow.com/a/46857525/5363071
---
include/utils/memory.hpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/utils/memory.hpp b/include/utils/memory.hpp
index daec5a30..d190f450 100644
--- a/include/utils/memory.hpp
+++ b/include/utils/memory.hpp
@@ -12,11 +12,20 @@ using malloc_ptr_t = shared_ptr;
namespace memory_util {
/**
* Create a shared pointer using malloc/free
+ *
+ * Generates a noexcept-type warning because the mangled name for
+ * malloc_ptr_t will change in C++17. This doesn't affect use because we have
+ * no public ABI, so we ignore it here.
+ * See also this SO answer: https://stackoverflow.com/a/46857525/5363071
*/
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wnoexcept-type"
template
inline malloc_ptr_t make_malloc_ptr(Deleter deleter = std::free) {
return malloc_ptr_t(static_cast(calloc(1, Size)), deleter);
}
+#pragma GCC diagnostic pop
/**
* Get the number of elements in T
@@ -25,6 +34,6 @@ namespace memory_util {
inline auto countof(T& p) {
return sizeof(p) / sizeof(p[0]);
}
-}
+} // namespace memory_util
POLYBAR_NS_END