Comments and sonar fixes

This commit is contained in:
Jeremy 2023-10-07 13:43:39 -04:00
parent 18da699aed
commit a422e132d4
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
3 changed files with 12 additions and 9 deletions

View File

@ -159,13 +159,14 @@ namespace cpptrace {
public: public:
explicit exception() noexcept : exception(1) {} explicit exception() noexcept : exception(1) {}
const char* what() const noexcept override; const char* what() const noexcept override;
// what(), but not a C-string. Performs lazy computation of the full what string. // what(), but not a C-string. Performs lazy evaluation of the full what string.
virtual const std::string& get_what() const noexcept; virtual const std::string& get_what() const noexcept;
// Just the plain what() value without the stacktrace // Just the plain what() value without the stacktrace. This value is called by get_what() during lazy
// evaluation.
virtual const char* get_raw_what() const noexcept; virtual const char* get_raw_what() const noexcept;
// returns internal raw_trace // Returns internal raw_trace
const raw_trace& get_raw_trace() const noexcept; const raw_trace& get_raw_trace() const noexcept;
// returns a resolved trace from the raw_trace. Handles lazy evaluation of the resolved trace. // Returns a resolved trace from the raw_trace. Handles lazy evaluation of the resolved trace.
const stacktrace& get_trace() const noexcept; const stacktrace& get_trace() const noexcept;
}; };

View File

@ -19,10 +19,10 @@ namespace libdwarf {
static_assert(std::is_pointer<Dwarf_Debug>::value, "Dwarf_Debug not a pointer"); static_assert(std::is_pointer<Dwarf_Debug>::value, "Dwarf_Debug not a pointer");
[[noreturn]] void handle_dwarf_error(Dwarf_Debug dbg, Dwarf_Error error) { [[noreturn]] void handle_dwarf_error(Dwarf_Debug dbg, Dwarf_Error error) {
int ev = dwarf_errno(error); unsigned ev = dwarf_errno(error);
char* msg = dwarf_errmsg(error); char* msg = dwarf_errmsg(error);
dwarf_dealloc_error(dbg, error); dwarf_dealloc_error(dbg, error);
throw std::runtime_error(stringf("Cpptrace dwarf error %d %s\n", ev, msg)); throw std::runtime_error(stringf("Cpptrace dwarf error %u %s\n", ev, msg));
} }
struct die_object { struct die_object {
@ -68,14 +68,14 @@ namespace libdwarf {
die_object& operator=(const die_object&) = delete; die_object& operator=(const die_object&) = delete;
die_object(die_object&& other) : dbg(other.dbg), die(other.die) { die_object(die_object&& other) noexcept : dbg(other.dbg), die(other.die) {
// done for finding mistakes, attempts to use the die_object after this should segfault // done for finding mistakes, attempts to use the die_object after this should segfault
// a valid use otherwise would be moved_from.get_sibling() which would get the next CU // a valid use otherwise would be moved_from.get_sibling() which would get the next CU
other.dbg = nullptr; other.dbg = nullptr;
other.die = nullptr; other.die = nullptr;
} }
die_object& operator=(die_object&& other) { die_object& operator=(die_object&& other) noexcept {
dbg = other.dbg; dbg = other.dbg;
die = other.die; die = other.die;
other.die = nullptr; other.die = nullptr;

View File

@ -100,7 +100,9 @@ namespace detail {
} }
template<typename T> template<typename T>
void nullfn() {} void nullfn() {
// this method doesn't do anything and is never called.
}
#define PHONY_USE(E) (nullfn<decltype(E)>()) #define PHONY_USE(E) (nullfn<decltype(E)>())