From df20ba4c740b5b626b7579bb3695cde21dc1a6fe Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Sun, 1 Sep 2024 16:41:43 +0100 Subject: [PATCH] Fix cppcheck 2.15.0 warnings --- sn3d.h | 6 +++++- vpkt.cc | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sn3d.h b/sn3d.h index d679e82bb..f7c90777f 100644 --- a/sn3d.h +++ b/sn3d.h @@ -99,7 +99,11 @@ inline thread_local auto gslworkspace = #ifdef __NVCOMPILER_CUDA_ARCH__ #define printout(...) printf(__VA_ARGS__) -#define __artis_assert(e) assert(e) +#define __artis_assert(e) \ + { \ + const bool assertpass = static_cast(e); \ + assert(assertpass) \ + } #else inline void print_line_start() { diff --git a/vpkt.cc b/vpkt.cc index 0f32febe1..aeeeaecb5 100644 --- a/vpkt.cc +++ b/vpkt.cc @@ -111,8 +111,8 @@ void add_to_vspecpol(const Packet &vpkt, const int obsdirindex, const int opacho } // Routine to add a packet to the outcoming spectrum. -void add_to_vpkt_grid(const Packet &vpkt, const std::array vel, const int wlbin, const int obsdirindex, - const std::array obs) { +void add_to_vpkt_grid(const Packet &vpkt, const std::array &vel, const int wlbin, const int obsdirindex, + const std::array &obs) { double vref1{NAN}; double vref2{NAN}; @@ -160,7 +160,7 @@ void add_to_vpkt_grid(const Packet &vpkt, const std::array vel, const } auto rlc_emiss_vpkt(const Packet &pkt, const double t_current, const double t_arrive, const double nu_rf, - const double e_rf, const int obsdirindex, const std::array obsdir, + const double e_rf, const int obsdirindex, const std::array &obsdir, const enum packet_type type_before_rpkt, std::stringstream &vpkt_contrib_row) -> bool { int mgi = 0;