bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.68k stars 467 forks source link

Fix compilation warnings #262

Closed Lecrapouille closed 1 year ago

Lecrapouille commented 2 years ago

Could be nice to fix some -Wold-style-cast warnings:

In file included from backward-cpp/backward.cpp:36:
backward-cpp/backward.hpp: In member function ‘virtual backward::ResolvedTrace backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::resolve(backward::ResolvedTrace)’:
backward-cpp/backward.hpp:1788:47: warning: use of old-style cast to ‘Dwarf_Addr’ {aka ‘long unsigned int’} [-Wold-style-cast]
 1788 |     Dwarf_Addr trace_addr = (Dwarf_Addr)trace.addr;
      |                                               ^~~~
      |                             ----------------------
      |                             reinterpret_cast<Dwarf_Addr> (trace.addr)
backward-cpp/backward.hpp: In member function ‘void backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::inliners_search_cb::operator()(Dwarf_Die*)’:
backward-cpp/backward.hpp:1968:31: warning: use of old-style cast to ‘unsigned int’ [-Wold-style-cast]
 1968 |         sloc.line = (unsigned)line;
      |                               ^~~~
      |                     --------------
      |                     static_cast<unsigned> (line)
backward-cpp/backward.hpp:1969:30: warning: use of old-style cast to ‘unsigned int’ [-Wold-style-cast]
 1969 |         sloc.col = (unsigned)col;
      |                              ^~~
      |                    -------------
      |                    static_cast<unsigned> (col)
bombela commented 1 year ago

Already merged.