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: | run: |
mkdir build mkdir build
cd 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 make -j
cd .. cd ..
- name: Run sonar-scanner - name: Run sonar-scanner

View File

@ -40,7 +40,7 @@ namespace cpptrace {
object_trace raw_trace::resolve_object_trace() const { object_trace raw_trace::resolve_object_trace() const {
try { try {
return object_trace(detail::get_frames_object_info(frames)); return object_trace(detail::get_frames_object_info(frames));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -56,7 +56,7 @@ namespace cpptrace {
frame.symbol = detail::demangle(frame.symbol); frame.symbol = detail::demangle(frame.symbol);
} }
return stacktrace(std::move(trace)); return stacktrace(std::move(trace));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -88,7 +88,7 @@ namespace cpptrace {
stacktrace object_trace::resolve() const { stacktrace object_trace::resolve() const {
try { try {
return stacktrace(detail::resolve_frames(frames)); return stacktrace(detail::resolve_frames(frames));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -241,7 +241,7 @@ namespace cpptrace {
raw_trace generate_raw_trace(std::uint_least32_t skip) { raw_trace generate_raw_trace(std::uint_least32_t skip) {
try { try {
return raw_trace(detail::capture_frames(skip + 1, UINT_LEAST32_MAX)); return raw_trace(detail::capture_frames(skip + 1, UINT_LEAST32_MAX));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -253,7 +253,7 @@ namespace cpptrace {
raw_trace generate_raw_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) { raw_trace generate_raw_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
try { try {
return raw_trace(detail::capture_frames(skip + 1, max_depth)); return raw_trace(detail::capture_frames(skip + 1, max_depth));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -265,7 +265,7 @@ namespace cpptrace {
object_trace generate_object_trace(std::uint_least32_t skip) { object_trace generate_object_trace(std::uint_least32_t skip) {
try { try {
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, UINT_LEAST32_MAX))); 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()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -277,7 +277,7 @@ namespace cpptrace {
object_trace generate_object_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) { object_trace generate_object_trace(std::uint_least32_t skip, std::uint_least32_t max_depth) {
try { try {
return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, max_depth))); return object_trace(detail::get_frames_object_info(detail::capture_frames(skip + 1, max_depth)));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -299,7 +299,7 @@ namespace cpptrace {
frame.symbol = detail::demangle(frame.symbol); frame.symbol = detail::demangle(frame.symbol);
} }
return stacktrace(std::move(trace)); return stacktrace(std::move(trace));
} catch(...) { } catch(...) { // NOSONAR
if(!detail::should_absorb_trace_exceptions()) { if(!detail::should_absorb_trace_exceptions()) {
throw; throw;
} }
@ -313,8 +313,8 @@ namespace cpptrace {
} }
namespace detail { namespace detail {
std::atomic_bool absorb_trace_exceptions(true); std::atomic_bool absorb_trace_exceptions(true); // NOSONAR
std::atomic<enum cache_mode> cache_mode(cache_mode::prioritize_speed); std::atomic<enum cache_mode> cache_mode(cache_mode::prioritize_speed); // NOSONAR
} }
CPPTRACE_API void absorb_trace_exceptions(bool absorb) { 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 typename std::enable_if<!std::is_same<typename std::decay<U>::type, optional<T>>::value, int>::type = 0
> >
optional& operator=(U&& value) { optional& operator=(U&& value) {
optional o(std::move(value)); optional o(std::forward<U>(value));
swap(o); swap(o);
return *this; return *this;
} }

View File

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

View File

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

View File

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

View File

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