Cause error explicitly from `MRB_TRY()` with `cxx_exception`; ref
`MRB_TRY()` does not work when compiled by C compiler with `cxx_exception`
configuration. We should explicitly warn.
MODIFY
include/mruby/throw.h
include/mruby/throw.h
# endif
#endif
-#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
+#if defined(MRB_ENABLE_CXX_EXCEPTION)
+
+# if defined(__cplusplus)
#define MRB_TRY(buf) try {
#define MRB_CATCH(buf) } catch(mrb_jmpbuf_impl e) { if (e != (buf)->impl) { throw e; }
#define MRB_THROW(buf) throw((buf)->impl)
typedef mrb_int mrb_jmpbuf_impl;
+# else
+# error "need to be compiled with C++ compiler"
+# endif /* __cplusplus */
+
#else
#include <setjmp.h>
@@ -46,10 +52,12 @@ typedef mrb_int mrb_jmpbuf_impl;
struct mrb_jmpbuf {
mrb_jmpbuf_impl impl;
-#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
+#if defined(MRB_ENABLE_CXX_EXCEPTION)
static mrb_int jmpbuf_id;
+# if defined(__cplusplus)
mrb_jmpbuf() : impl(jmpbuf_id++) {}
# endif
+#endif
};
#endif /* MRB_THROW_H */

Cause error explicitly from `MRB_TRY()` with `cxx_exception`; ref #5088

`MRB_TRY()` does not work when compiled by C compiler with `cxx_exception`
configuration. We should explicitly warn.