Fix bazel DM target Addresses a warning as error (unique-object-duplication) that arises because the inline functions defined in Test.h use a macro (TRACE_EVENT1) that expands into `static std::atomic`. Mac's compiler doesn't like static variables in inline functions with hidden visibility. Bug: 480952153 Change-Id: Ib605a1e2274cda125d872d8e51c1d5a9be73efcf Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1287397 Commit-Queue: Jorge Betancourt <jmbetancourt@google.com> Reviewed-by: Kaylee Lubick <kjlubick@google.com>
diff --git a/tests/Test.cpp b/tests/Test.cpp index 2027d7e..ba16158 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp
@@ -86,3 +86,26 @@ SkASSERT(TimeUtils::MSecMax >= elapsedMs); return static_cast<TimeUtils::MSec>(elapsedMs); } + +namespace skiatest { + +void Test::cpu(skiatest::Reporter* r) const { + SkASSERT(this->fTestType == TestType::kCPU || + this->fTestType == TestType::kCPUSerial); + TRACE_EVENT1("test_cpu", TRACE_FUNC, "name", this->fName/*these are static*/); + this->fCPUProc(r); +} + +void Test::ganesh(skiatest::Reporter* r, const GrContextOptions& options) const { + SkASSERT(this->fTestType == TestType::kGanesh); + TRACE_EVENT1("test_ganesh", TRACE_FUNC, "name", this->fName/*these are static*/); + this->fGaneshProc(r, options); +} + +void Test::graphite(skiatest::Reporter* r, const graphite::TestOptions& options) const { + SkASSERT(this->fTestType == TestType::kGraphite); + TRACE_EVENT1("test_graphite", TRACE_FUNC, "name", this->fName/*these are static*/); + this->fGraphiteProc(r, options); +} + +} // namespace skiatest
diff --git a/tests/Test.h b/tests/Test.h index 94d5092..20a5916 100644 --- a/tests/Test.h +++ b/tests/Test.h
@@ -165,24 +165,11 @@ } } - void cpu(skiatest::Reporter* r) const { - SkASSERT(this->fTestType == TestType::kCPU || - this->fTestType == TestType::kCPUSerial); - TRACE_EVENT1("test_cpu", TRACE_FUNC, "name", this->fName/*these are static*/); - this->fCPUProc(r); - } + void cpu(skiatest::Reporter* r) const; - void ganesh(skiatest::Reporter* r, const GrContextOptions& options) const { - SkASSERT(this->fTestType == TestType::kGanesh); - TRACE_EVENT1("test_ganesh", TRACE_FUNC, "name", this->fName/*these are static*/); - this->fGaneshProc(r, options); - } + void ganesh(skiatest::Reporter* r, const GrContextOptions& options) const; - void graphite(skiatest::Reporter* r, const graphite::TestOptions& options) const { - SkASSERT(this->fTestType == TestType::kGraphite); - TRACE_EVENT1("test_graphite", TRACE_FUNC, "name", this->fName/*these are static*/); - this->fGraphiteProc(r, options); - } + void graphite(skiatest::Reporter* r, const graphite::TestOptions& options) const; private: Test(const char* name,
diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 8bd5c67..bed489a 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel
@@ -66,6 +66,7 @@ skia_objc_library( name = "autorelease_pool_objc", hdrs = ["AutoreleasePool.h"], + mac_frameworks = ["Foundation"], non_arc_srcs = ["AutoreleasePool.mm"], visibility = ["//tools/ganesh:__pkg__"], deps = ["//:core"],