Skip to content

Commit

Permalink
Fix undefined-var-template warning emitted from clang
Browse files Browse the repository at this point in the history
This is part of PR #1684 from @charlesfleche

(Internal change: 2263141)
  • Loading branch information
sunyab authored and pixar-oss committed Feb 16, 2023
1 parent 3609cfc commit c166762
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pxr/usd/sdf/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit c166762

Please sign in to comment.