greg7mdp / parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.
https://greg7mdp.github.io/parallel-hashmap/
Apache License 2.0
2.47k stars 234 forks source link

Unused variable warning when PHMAP_HAVE_EXCEPTIONS is false #194

Closed bpmckinnon closed 1 year ago

bpmckinnon commented 1 year ago

The functions ThrowStd* have an unused variable when PHMAP_HAVE_EXCEPTIONS is false. It looks like this issue was introduced when the Throw function was replaced with a macro. I can take a look at this if you like. Would you prefer a revert or a PHMAP_UNUSED macro? There is [[maybe_unused]] to, but I think you support beyond c++17.

greg7mdp commented 1 year ago

Thanks. Yes I do support c++11 in phmap. What about this?

#ifdef PHMAP_HAVE_EXCEPTIONS
  #define PHMAP_THROW_IMPL(e) throw e
#else
  #define PHMAP_THROW_IMPL(e) do { e; std::abort(); } while(0)
#endif
bpmckinnon commented 1 year ago

Does it need to be (void)(e); ?

greg7mdp commented 1 year ago

I don't think so, but it wouldn't hurt. Would you like me to do the change?

greg7mdp commented 1 year ago

Thanks again for reporting this @bpmckinnon . Should be fixed now and closing the issue.