summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-02-15 19:23:15 -0800
committerGitHub <noreply@github.com>2018-02-15 19:23:15 -0800
commit7b196f2f743d05f56dfec2b8f005e3f74b8ad2bc (patch)
tree8a146b2c35d31171a853de3c50cf76756d4fc93f /src/common.h
parentd77796e39c0fc15a2710faa76fea126bec40b206 (diff)
downloadwabt-7b196f2f743d05f56dfec2b8f005e3f74b8ad2bc.tar.gz
wabt-7b196f2f743d05f56dfec2b8f005e3f74b8ad2bc.tar.bz2
wabt-7b196f2f743d05f56dfec2b8f005e3f74b8ad2bc.zip
Add try/catch around calls to reserve (#761)
Only when exceptions are enabled via the CMake `WITH_EXCEPTIONS` option.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index dbbf28b8..d12edb0a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -76,6 +76,10 @@
#if WITH_EXCEPTIONS
#define WABT_TRY try {
+#define WABT_CATCH_BAD_ALLOC \
+ } \
+ catch (std::bad_alloc&) { \
+ }
#define WABT_CATCH_BAD_ALLOC_AND_EXIT \
} \
catch (std::bad_alloc&) { \
@@ -83,6 +87,7 @@
}
#else
#define WABT_TRY
+#define WABT_CATCH_BAD_ALLOC
#define WABT_CATCH_BAD_ALLOC_AND_EXIT
#endif