From c1667622a02dce76e10b7f78b862222a44cc5471 Mon Sep 17 00:00:00 2001 From: sunyab Date: Tue, 14 Feb 2023 14:37:52 -0800 Subject: [PATCH] Fix undefined-var-template warning emitted from clang This is part of PR #1684 from @charlesfleche (Internal change: 2263141) --- pxr/usd/sdf/pool.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pxr/usd/sdf/pool.h b/pxr/usd/sdf/pool.h index 3b1af6b016..a803d32d48 100644 --- a/pxr/usd/sdf/pool.h +++ b/pxr/usd/sdf/pool.h @@ -237,9 +237,16 @@ class Sdf_Pool static inline Handle _GetHandle(char const *ptr) { if (ptr) { for (unsigned region = 1; region != NumRegions+1; ++region) { + // Suppress undefined-var-template warnings from clang; _regionStarts + // is expected to be instantiated in another translation unit via + // the SDF_INSTANTIATE_POOL macro. + ARCH_PRAGMA_PUSH + ARCH_PRAGMA_UNDEFINED_VAR_TEMPLATE + uintptr_t start = (uintptr_t)_regionStarts[region]; + ARCH_PRAGMA_POP + // We rely on modular arithmetic so that if ptr is less than // start, the diff will be larger than ElemsPerRegion*ElemSize. - uintptr_t start = (uintptr_t)_regionStarts[region]; uintptr_t diff = (uintptr_t)ptr - start; if (diff < (uintptr_t)(ElemsPerRegion*ElemSize)) { return Handle(