Hoernchen has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/32941 )
Change subject: ms : fix the template formatting ......................................................................
ms : fix the template formatting
Those lines predate the .clang-format changes.
Change-Id: I891bdf95004accebbbe54916e4472bd381fac545 --- M Transceiver52M/ms/bladerf_specific.h M Transceiver52M/ms/ms.cpp M Transceiver52M/ms/uhd_specific.h 3 files changed, 35 insertions(+), 13 deletions(-)
Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/Transceiver52M/ms/bladerf_specific.h b/Transceiver52M/ms/bladerf_specific.h index d5088a7..e1e8cc6 100644 --- a/Transceiver52M/ms/bladerf_specific.h +++ b/Transceiver52M/ms/bladerf_specific.h @@ -39,14 +39,16 @@ const int SAMPLE_SCALE_FACTOR = 15; // actually 16 but sigproc complains about clipping..
// see https://en.cppreference.com/w/cpp/language/parameter_pack "Brace-enclosed initializers" example -template <typename Arg, typename... Args> void expand_args(std::ostream &out, Arg &&arg, Args &&...args) +template <typename Arg, typename... Args> +void expand_args(std::ostream &out, Arg &&arg, Args &&...args) { out << '(' << std::forward<Arg>(arg); (void)(int[]){ 0, (void((out << "," << std::forward<Args>(args))), 0)... }; out << ')' << std::endl; }
-template <class R, class... Args> using RvalFunc = R (*)(Args...); +template <class R, class... Args> +using RvalFunc = R (*)(Args...);
template <class R, class... Args> R exec_and_check(RvalFunc<R, Args...> func, const char *fname, const char *finame, const char *funcname, int line, @@ -67,7 +69,8 @@ #pragma pack(push, 1) using blade_sample_type = std::complex<int16_t>; enum class blade_speed_buffer_type { HS, SS }; -template <blade_speed_buffer_type T> struct blade_usb_message { +template <blade_speed_buffer_type T> +struct blade_usb_message { uint32_t reserved; uint64_t ts; uint32_t meta_flags; @@ -76,7 +79,8 @@
static_assert(sizeof(blade_usb_message<blade_speed_buffer_type::SS>) == 2048, "blade buffer mismatch!"); static_assert(sizeof(blade_usb_message<blade_speed_buffer_type::HS>) == 1024, "blade buffer mismatch!"); -template <unsigned int SZ, blade_speed_buffer_type T> struct blade_otw_buffer { +template <unsigned int SZ, blade_speed_buffer_type T> +struct blade_otw_buffer { static_assert((SZ >= 2 && !(SZ % 2)), "min size is 2x usb buffer!"); blade_usb_message<T> m[SZ]; int actual_samples_per_msg() @@ -172,7 +176,8 @@ }; #pragma pack(pop)
-template <unsigned int SZ, blade_speed_buffer_type T> struct blade_otw_buffer_helper { +template <unsigned int SZ, blade_speed_buffer_type T> +struct blade_otw_buffer_helper { static_assert((SZ >= 1024 && ((SZ & (SZ - 1)) == 0)), "only buffer size multiples of 1024 allowed!"); static blade_otw_buffer<SZ / 512, T> x; }; @@ -181,7 +186,8 @@ // using buf_in_use = blade_otw_buffer<2, blade_speed_buffer_type::SS>; using bh_fn_t = std::function<int(dev_buf_t *)>;
-template <typename T> struct blade_hw { +template <typename T> +struct blade_hw { struct bladerf *dev; struct bladerf_stream *rx_stream; struct bladerf_stream *tx_stream; diff --git a/Transceiver52M/ms/ms.cpp b/Transceiver52M/ms/ms.cpp index ec2c5f8..d191ed5 100644 --- a/Transceiver52M/ms/ms.cpp +++ b/Transceiver52M/ms/ms.cpp @@ -49,7 +49,8 @@ static int offset_ctr = 0; #endif
-template <> std::atomic<bool> ms_trx::base::stop_me_flag(false); +template <> +std::atomic<bool> ms_trx::base::stop_me_flag(false);
void tx_test(ms_trx *t, ts_hitter_q_t *q, unsigned int *tsc) { @@ -137,7 +138,8 @@ } } #ifdef SYNCTHINGONLY -template <typename A> auto parsec(std::vectorstd::string &v, A &itr, std::string arg, bool *rv) +template <typename A> +auto parsec(std::vectorstd::string &v, A &itr, std::string arg, bool *rv) { if (*itr == arg) { *rv = true; @@ -158,15 +160,17 @@ } return false; } -template <typename A> bool parsec(std::vectorstd::string &v, A &itr, std::string arg, int scale, int *rv) +template <typename A> +bool parsec(std::vectorstd::string &v, A &itr, std::string arg, int scale, int *rv) { return parsec( - v, itr, arg, [scale](const char *v) -> auto{ return atoi(v) * scale; }, rv); + v, itr, arg, [scale](const char *v) -> auto { return atoi(v) * scale; }, rv); } -template <typename A> bool parsec(std::vectorstd::string &v, A &itr, std::string arg, int scale, unsigned int *rv) +template <typename A> +bool parsec(std::vectorstd::string &v, A &itr, std::string arg, int scale, unsigned int *rv) { return parsec( - v, itr, arg, [scale](const char *v) -> auto{ return atoi(v) * scale; }, rv); + v, itr, arg, [scale](const char *v) -> auto { return atoi(v) * scale; }, rv); }
int main(int argc, char *argv[]) diff --git a/Transceiver52M/ms/uhd_specific.h b/Transceiver52M/ms/uhd_specific.h index 8295a54..726bb95 100644 --- a/Transceiver52M/ms/uhd_specific.h +++ b/Transceiver52M/ms/uhd_specific.h @@ -65,7 +65,8 @@ using dev_buf_t = uhd_buf_wrap; using bh_fn_t = std::function<int(dev_buf_t *)>;
-template <typename T> struct uhd_hw { +template <typename T> +struct uhd_hw { uhd::usrp::multi_usrp::sptr dev; uhd::rx_streamer::sptr rx_stream; uhd::tx_streamer::sptr tx_stream;