summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-12-10 13:21:08 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-12-10 13:21:08 +0100
commit93d56294cf6f7af39679a871f51087be34f813a2 (patch)
tree24968fa7a096380f13267099a3e85f3bf583ba1f /include
parent127600ef8cc6ab47d42725df0cd63c680662f950 (diff)
downloadqtlocation-mapboxgl-93d56294cf6f7af39679a871f51087be34f813a2.tar.gz
update error reporting function
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/gl.hpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index 6a35ab8006..b639094461 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -172,6 +172,9 @@ struct group {
inline group(const std::string &str) { start_group(str); }
~group() { end_group(); };
};
+
+void checkError(const char *cmd, const char *file, int line);
+
}
}
@@ -180,12 +183,10 @@ struct group {
#define glDepthRange glDepthRangef
#endif
-void _CHECK_GL_ERROR(const char *cmd, const char *file, int line);
-
-#define _CHECK_ERROR(cmd, file, line) \
- cmd; \
- do { _CHECK_GL_ERROR(#cmd, file, line); } while (false);
-
-#define CHECK_ERROR(cmd) _CHECK_ERROR(cmd, __FILE__, __LINE__)
+#if defined(DEBUG)
+#define MBGL_CHECK_ERROR(cmd) ([&]() { struct _ { inline ~_() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } _; return cmd; }())
+#else
+#define MBGL_CHECK_ERROR(cmd) (cmd)
+#endif
#endif