Skip to content

Commit

Permalink
Fix useless cast warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Oct 6, 2023
1 parent 2f507cc commit 2b1a2c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/platform/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ namespace detail {
unsigned long long to_ull(T t) {
return static_cast<unsigned long long>(t);
}
template<typename T>
unsigned long long to_uintptr(T t) {
return static_cast<uintptr_t>(t);
}

// A way to cast to U without "warning: useless cast to type"
template<typename U, typename V>
Expand Down
2 changes: 1 addition & 1 deletion src/unwind/unwind_with_dbghelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace detail {
// On x86/x64/arm, as far as I can tell, the frame return address is always one after the call
// So we just decrement to get the pc back inside the `call` / `bl`
// This is done with _Unwind too but conditionally based on info from _Unwind_GetIPInfo.
trace.push_back(static_cast<uintptr_t>(frame.AddrPC.Offset) - 1);
trace.push_back(to_uintptr(frame.AddrPC.Offset) - 1);
}
} else {
// base
Expand Down

0 comments on commit 2b1a2c7

Please sign in to comment.