backward-cpp icon indicating copy to clipboard operation
backward-cpp copied to clipboard

switch-default and old-style-cast on gcc 8

Open vaurelios opened this issue 7 years ago • 1 comments

gcc 8 complains about switch without a default case and about old style cast ((type) var) as mentioned in anbox/anbox#809

vaurelios avatar Jul 11 '18 12:07 vaurelios

SHA1 27349d0a751e8a0bc62d60c198972712020f34ac In the same way compiling my project against backward with all my g++ (g++ Debian 6.3.0-18+deb9u1 6.3.0 20170516) flags produce these following warnings:

backward-cpp/backward.hpp: In member function ‘backward::ResolvedTrace backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::resolve(backward::ResolvedTrace)’:
backward-cpp/backward.hpp:1328:46: warning: use of old-style cast [-Wold-style-cast]
   Dwarf_Addr trace_addr = (Dwarf_Addr) trace.addr;
                                              ^~~~
backward-cpp/backward.hpp:1461:24: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
    trace.source.line = line;
                        ^~~~
backward-cpp/backward.hpp:1462:23: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
    trace.source.col = col;
                       ^~~
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:1511:28: warning: use of old-style cast [-Wold-style-cast]
      sloc.line = (unsigned)line;
                            ^~~~
backward-cpp/backward.hpp:1512:27: warning: use of old-style cast [-Wold-style-cast]
      sloc.col = (unsigned)col;
                           ^~~
backward-cpp/backward.hpp:1487:11: warning: switch missing default case [-Wswitch-default]
    switch (dwarf_tag(die)) {
           ^
backward-cpp/backward.hpp: In static member function ‘static Dwarf_Die* backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::find_fundie_by_pc(Dwarf_Die*, Dwarf_Addr, Dwarf_Die*)’:
backward-cpp/backward.hpp:1563:11: warning: switch missing default case [-Wswitch-default]
    switch (dwarf_tag(die)) {
           ^
backward-cpp/backward.hpp: In static member function ‘static const char* backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::die_call_file(Dwarf_Die*)’:
backward-cpp/backward.hpp:1644:45: warning: conversion to ‘size_t {aka long unsigned int}’ from ‘Dwarf_Sword {aka long int}’ may change the sign of the result [-Wsign-conversion]
   return dwarf_filesrc(files, file_idx, 0, 0);

Lecrapouille avatar Jun 29 '19 18:06 Lecrapouille