summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-10-09 17:22:40 +0300
committerKonstantin Käfer <mail@kkaefer.com>2019-01-02 12:00:03 +0100
commit2d96d812ebe5067e6d14741f56283de3b0574587 (patch)
tree66daa65d320b8a3f9d03343d7f9884f0c18dcb60
parent2c19356ae6537b42e90db8c77cf317b53f628c4f (diff)
downloadqtlocation-mapboxgl-upstream/convert-inline.tar.gz
[core] don't inline convert() calls to reduce binary sizeupstream/convert-inline
-rw-r--r--include/mbgl/style/conversion_impl.hpp3
-rw-r--r--include/mbgl/util/util.hpp7
2 files changed, 9 insertions, 1 deletions
diff --git a/include/mbgl/style/conversion_impl.hpp b/include/mbgl/style/conversion_impl.hpp
index 27b2ee1917..1ce630f43b 100644
--- a/include/mbgl/style/conversion_impl.hpp
+++ b/include/mbgl/style/conversion_impl.hpp
@@ -4,6 +4,7 @@
#include <mbgl/util/optional.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/util/geojson.hpp>
+#include <mbgl/util/util.hpp>
#include <string>
@@ -293,7 +294,7 @@ private:
};
template <class T, class...Args>
-optional<T> convert(const Convertible& value, Error& error, Args&&...args) {
+MBGL_NOINLINE optional<T> convert(const Convertible& value, Error& error, Args&&...args) {
return Converter<T>()(value, error, std::forward<Args>(args)...);
}
diff --git a/include/mbgl/util/util.hpp b/include/mbgl/util/util.hpp
index 7960b40299..b40b2a1938 100644
--- a/include/mbgl/util/util.hpp
+++ b/include/mbgl/util/util.hpp
@@ -19,3 +19,10 @@
#else
#define MBGL_CONSTEXPR inline
#endif
+
+// Control inlining
+#ifdef _MSC_VER
+#define MBGL_NOINLINE __declspec(noinline)
+#else
+#define MBGL_NOINLINE __attribute__((noinline))
+#endif