Closed ilobilo closed 1 year ago
Hi, just noticed this one when updating. I've started getting the unused variable warning again.
I've tested out a change that will remove the warning, but also remove the need to have those types defined.
Let me know what you think.
#ifdef PHMAP_HAVE_EXCEPTIONS
#define PHMAP_THROW_IMPL_MSG(e, message) throw e(message)
#define PHMAP_THROW_IMPL(e) throw e
#else
#define PHMAP_THROW_IMPL_MSG(e, message) do { (void)(message); std::abort(); } while(0)
#define PHMAP_THROW_IMPL(e) std::abort()
#endif
} // namespace
static inline void ThrowStdLogicError(const std::string& what_arg) {
PHMAP_THROW_IMPL_MSG(std::logic_error, what_arg);
}
static inline void ThrowStdBadFunctionCall() {
PHMAP_THROW_IMPL(std::bad_function_call());
}
Oh I didn't notice that what_arg
wasn't being used anymore with std::abort()
, my bad.
But yes, your solution should fix the warning and it's cleaner than using [[maybe_unused]]
everywhere.
@bpmckinnon 's solution was checked-in earlier this morning, so we should be all set. Thanks to both of you for your contribs.
remove creation and then casting to (void) of std::*_error objects if exceptions are disabled this also removes the need for those classes to be available to use this library