summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-06-26 19:37:11 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-06-29 11:32:19 +0200
commit45d0cbb4c722d84eb178515a205f58d4b4434c87 (patch)
treebfbf2518cca831f8d9e33407ca110b09c9d25b18 /src
parente66bd34bffbb0ac883fd95039fab86ced6208727 (diff)
downloadqtlocation-mapboxgl-45d0cbb4c722d84eb178515a205f58d4b4434c87.tar.gz
add assert_always() macro for release build assertions
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/util/assert.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mbgl/util/assert.hpp b/src/mbgl/util/assert.hpp
new file mode 100644
index 0000000000..0c2f63f8fe
--- /dev/null
+++ b/src/mbgl/util/assert.hpp
@@ -0,0 +1,13 @@
+#ifndef MBGL_UTIL_ASSERT
+#define MBGL_UTIL_ASSERT
+
+#include <cassert>
+
+// Based on FreeBSD's src/include/assert.h
+// Licensed under the original BSD license
+#define assert_always(expr) \
+ ((void)((expr) ? ((void)0) : ((void)fprintf(stderr, "%s:%u: failed assertion `%s'\n", \
+ __FILE__, __LINE__, #expr), \
+ abort())))
+
+#endif