diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3c7586..c3e3c53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -208,6 +208,14 @@ target_include_directories(
$
)
+target_compile_options(
+ ${target_name}
+ PRIVATE
+ $<$>:-Wall -Wextra -Werror=return-type -Wundef>
+ $<$:-Wuseless-cast>
+ $<$:/W4 /WX /permissive->
+)
+
# ---- Generate Build Info Headers ----
# used in export header generated below
diff --git a/src/platform/dwarf.hpp b/src/platform/dwarf.hpp
index c8a6ee4..7ea6886 100644
--- a/src/platform/dwarf.hpp
+++ b/src/platform/dwarf.hpp
@@ -26,6 +26,7 @@ namespace libdwarf {
[[noreturn]] void handle_dwarf_error(Dwarf_Debug dbg, Dwarf_Error error) {
Dwarf_Unsigned ev = dwarf_errno(error);
char* msg = dwarf_errmsg(error);
+ (void)dbg;
// dwarf_dealloc_error(dbg, error);
throw std::runtime_error(stringf("Cpptrace dwarf error %u %s\n", ev, msg));
}
diff --git a/src/symbols/symbols_with_libdwarf.cpp b/src/symbols/symbols_with_libdwarf.cpp
index 036c80e..424a5a6 100644
--- a/src/symbols/symbols_with_libdwarf.cpp
+++ b/src/symbols/symbols_with_libdwarf.cpp
@@ -71,6 +71,7 @@ namespace libdwarf {
Dwarf_Line line;
optional path;
optional line_number;
+ line_entry(Dwarf_Addr low, Dwarf_Line line) : low(low), line(line) {}
};
struct line_table_info {
@@ -282,7 +283,6 @@ namespace libdwarf {
std::string subprogram_symbol(
const die_object& die,
- Dwarf_Addr pc,
Dwarf_Half dwversion
) {
ASSERT(die.get_tag() == DW_TAG_subprogram || die.get_tag() == DW_TAG_inlined_subroutine);
@@ -299,10 +299,10 @@ namespace libdwarf {
} else {
if(die.has_attr(DW_AT_specification)) {
die_object spec = die.resolve_reference_attribute(DW_AT_specification);
- return subprogram_symbol(spec, 0, dwversion);
+ return subprogram_symbol(spec, dwversion);
} else if(die.has_attr(DW_AT_abstract_origin)) {
die_object spec = die.resolve_reference_attribute(DW_AT_abstract_origin);
- return subprogram_symbol(spec, 0, dwversion);
+ return subprogram_symbol(spec, dwversion);
}
}
return "";
@@ -314,7 +314,7 @@ namespace libdwarf {
char** dw_srcfiles;
Dwarf_Signed dw_filecount;
VERIFY(wrap(dwarf_srcfiles, cu_die.get(), &dw_srcfiles, &dw_filecount) == DW_DLV_OK);
- if(file_i < dw_filecount) {
+ if(Dwarf_Signed(file_i) < dw_filecount) {
filename = dw_srcfiles[file_i - 1];
}
dwarf_dealloc(cu_die.dbg, dw_srcfiles, DW_DLA_LIST);
@@ -329,7 +329,7 @@ namespace libdwarf {
}
char** dw_srcfiles = it->second.first;
Dwarf_Signed dw_filecount = it->second.second;
- if(file_i < dw_filecount) {
+ if(Dwarf_Signed(file_i) < dw_filecount) {
filename = dw_srcfiles[file_i - 1];
}
}
@@ -346,11 +346,11 @@ namespace libdwarf {
ASSERT(die.get_tag() == DW_TAG_subprogram || die.get_tag() == DW_TAG_inlined_subroutine);
auto child = die.get_child();
if(child) {
- if(pc) walk_die_list(
+ walk_die_list(
child,
[this, &cu_die, pc, dwversion, &inlines] (const die_object& die) {
if(die.get_tag() == DW_TAG_inlined_subroutine && die.pc_in_die(dwversion, pc)) {
- const auto name = subprogram_symbol(die, pc, dwversion);
+ const auto name = subprogram_symbol(die, dwversion);
const auto file_i = die.get_unsigned_attribute(DW_AT_call_file);
std::string file = file_i ? resolve_filename(cu_die, file_i.unwrap()) : "";
const auto line = die.get_unsigned_attribute(DW_AT_call_line);
@@ -379,7 +379,7 @@ namespace libdwarf {
std::vector& inlines
) {
ASSERT(die.get_tag() == DW_TAG_subprogram);
- const auto name = subprogram_symbol(die, pc, dwversion);
+ const auto name = subprogram_symbol(die, dwversion);
get_inlines_info(cu_die, die, pc, dwversion, inlines);
return name;
}
@@ -588,7 +588,6 @@ namespace libdwarf {
) == DW_DLV_OK
);
- Dwarf_Addr last_pc = 0;
// TODO: Make any attempt to note PC ranges? Handle line end sequence?
for(int i = 0; i < line_count; i++) {
Dwarf_Line line = line_buffer[i];
@@ -624,7 +623,7 @@ namespace libdwarf {
// }
line_entries.push_back({
low_addr,
- line // j - 1
+ line
});
i = j - 1;
}