Sonar fixes (#52)

This commit is contained in:
Jeremy Rifkin 2023-10-05 11:17:39 -04:00 committed by GitHub
parent 75677dda70
commit ddad92b1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 17 deletions

View File

@ -21,7 +21,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_BUILD_DEMO=On -DCPPTRACE_BUILD_TEST=On -DCMAKE_EXPORT_COMPILE_COMMANDS=On
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_BUILD_DEMO=On -DCPPTRACE_BUILD_TEST=On -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCMAKE_CXX_STANDARD=11
make -j
cd ..
- name: Run sonar-scanner

View File

@ -40,7 +40,7 @@ namespace cpptrace {
object_trace raw_trace::resolve_object_trace() const {
try {
return object_trace(detail::get_frames_object_info(frames));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -56,7 +56,7 @@ namespace cpptrace {
frame.symbol = detail::demangle(frame.symbol);
}
return stacktrace(std::move(trace));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -88,7 +88,7 @@ namespace cpptrace {
stacktrace object_trace::resolve() const {
try {
return stacktrace(detail::resolve_frames(frames));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -241,7 +241,7 @@ namespace cpptrace {
raw_trace generate_raw_trace(std::uint_least32_t skip) {
try {
return raw_trace(detail::capture_frames(skip + 1, UINT_LEAST32_MAX));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -253,7 +253,7 @@ namespace cpptrace {
raw_trace generate_raw_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
try {
return raw_trace(detail::capture_frames(skip + 1, max_depth));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -265,7 +265,7 @@ namespace cpptrace {
object_trace generate_object_trace(std::uint_least32_t skip) {
try {
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, UINT_LEAST32_MAX)));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -277,7 +277,7 @@ namespace cpptrace {
object_trace generate_object_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
try {
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, max_depth)));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -299,7 +299,7 @@ namespace cpptrace {
frame.symbol = detail::demangle(frame.symbol);
}
return stacktrace(std::move(trace));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}
@ -313,8 +313,8 @@ namespace cpptrace {
}
namespace detail {
std::atomic_bool absorb_trace_exceptions(true);
std::atomic<enum cache_mode> cache_mode(cache_mode::prioritize_speed);
std::atomic_bool absorb_trace_exceptions(true); // NOSONAR
std::atomic<enum cache_mode> cache_mode(cache_mode::prioritize_speed); // NOSONAR
}
CPPTRACE_API void absorb_trace_exceptions(bool absorb) {

View File

@ -230,7 +230,7 @@ namespace detail {
typename std::enable_if<!std::is_same<typename std::decay<U>::type, optional<T>>::value, int>::type = 0
>
optional& operator=(U&& value) {
optional o(std::move(value));
optional o(std::forward<U>(value));
swap(o);
return *this;
}

View File

@ -301,7 +301,7 @@ namespace addr2line {
for(size_t i = 0; i < output.size(); i++) {
update_trace(output[i], i, entries_vec);
}
} catch(...) {
} catch(...) { // NOSONAR
if(!should_absorb_trace_exceptions()) {
throw;
}

View File

@ -408,7 +408,7 @@ namespace dbghelp {
for(const auto frame : frames) {
try {
trace.push_back(resolve_frame(proc, frame));
} catch(...) {
} catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) {
throw;
}

View File

@ -77,7 +77,7 @@ namespace libbacktrace {
);
}
return frame;
} catch(...) {
} catch(...) { // NOSONAR
if(!should_absorb_trace_exceptions()) {
throw;
}

View File

@ -667,7 +667,7 @@ namespace libdwarf {
const auto& dlframe = entry.first.get();
auto& frame = entry.second.get();
frame = resolver->resolve_frame(dlframe);
} catch(...) {
} catch(...) { // NOSONAR
if(!should_absorb_trace_exceptions()) {
throw;
}
@ -678,7 +678,7 @@ namespace libdwarf {
// .emplace needed, for some reason .insert tries to copy <= gcc 7.2
resolver_map.emplace(obj_name, std::move(resolver_object).unwrap());
}
} catch(...) {
} catch(...) { // NOSONAR
if(!should_absorb_trace_exceptions()) {
throw;
}