aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-20 14:25:06 -0700
committerChris Robinson <[email protected]>2019-09-20 14:25:06 -0700
commit2ab4883439b1bc96578e86cc894504b9a1d1021b (patch)
treef7ecd56b7133c77b0596254ea7a09c0fbc3083cf
parent65eb0987e2f08655575f4d835e178b483901a053 (diff)
Silence some unreachable code warnings on MSVC
-rw-r--r--common/alexcpt.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/alexcpt.h b/common/alexcpt.h
index ff09bab2..654520cb 100644
--- a/common/alexcpt.h
+++ b/common/alexcpt.h
@@ -31,6 +31,18 @@ public:
#define START_API_FUNC try
+#ifndef _MSC_VER
#define END_API_FUNC catch(...) { std::terminate(); }
+#else
+/* VS 2015 complains that some of these catch statements are unreachable code,
+ * due to the function body not able to throw anything. While technically true,
+ * it's preferable to mark API functions just in case that ever changes, so
+ * silence that warning.
+ */
+#define END_API_FUNC __pragma(warning(push)) \
+__pragma(warning(disable : 4702)) \
+catch(...) { std::terminate(); } \
+__pragma(warning(pop))
+#endif
#endif /* ALEXCPT_H */