Mark inline functions in SkTypes.h as static.
If these are not marked static (or SK_FORCE_INLINE) they become extremely dangerous to use from files built with different optimization flags than the baseline. The One Definition Rule becomes trivially easy to violate, and the linker can easily pick a CPU-specific version of the function.
TBR=reed@google.com
BUG=chromium:664864
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4752
Change-Id: If3044a32229db1a1e3a8b83aace6047d92b36d05
Reviewed-on: https://skia-review.googlesource.com/4752
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 0a3e3ac..2cc4b9c 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -395,7 +395,7 @@
/** Generic swap function. Classes with efficient swaps should specialize this function to take
their fast path. This function is used by SkTSort. */
-template <typename T> inline void SkTSwap(T& a, T& b) {
+template <typename T> static inline void SkTSwap(T& a, T& b) {
T c(std::move(a));
a = std::move(b);
b = std::move(c);
@@ -409,7 +409,7 @@
return value;
}
-template <typename T> inline T SkTAbs(T value) {
+template <typename T> static inline T SkTAbs(T value) {
if (value < 0) {
value = -value;
}