From 38f848ecdf374caac78d71c7413a9063b8bef742 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Mon, 27 Apr 2020 16:24:57 +0100 Subject: [PATCH] fix type name deducing for clang --- lib/include/srslte/common/type_utils.h | 16 ++++++++++++++++ srsenb/test/phy/enb_phy_test.cc | 2 +- srsepc/hdr/mme/mme_gtpc.h | 5 ++--- srsue/test/phy/ue_phy_test.cc | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/include/srslte/common/type_utils.h b/lib/include/srslte/common/type_utils.h index b7e14c5bf..6edd6b9e2 100644 --- a/lib/include/srslte/common/type_utils.h +++ b/lib/include/srslte/common/type_utils.h @@ -66,6 +66,22 @@ std::string get_type_name() return s; } +#elif defined(__clang__) +template +std::string get_type_name() +{ + static const char* funcname = __PRETTY_FUNCTION__; + static const std::string s = []() { + static const char* pos1 = strchr(funcname, '=') + 2; + static const char* pos2 = strchr(pos1, ']'); + std::string s2{pos1, pos2}; + size_t colon_pos = s2.rfind(':'); + std::string s3 = colon_pos == std::string::npos ? s2 : s2.substr(colon_pos + 1, s2.size()); + return s3.find('>') == std::string::npos ? s3 : s2; + }(); + return s; +} + #else template std::string get_type_name() diff --git a/srsenb/test/phy/enb_phy_test.cc b/srsenb/test/phy/enb_phy_test.cc index bb40a8070..b9a130854 100644 --- a/srsenb/test/phy/enb_phy_test.cc +++ b/srsenb/test/phy/enb_phy_test.cc @@ -66,7 +66,7 @@ private: received_##NAME = true; \ } -class dummy_radio : public srslte::radio_interface_phy +class dummy_radio final : public srslte::radio_interface_phy { private: std::mutex mutex; diff --git a/srsepc/hdr/mme/mme_gtpc.h b/srsepc/hdr/mme/mme_gtpc.h index 3fed1c6ac..9ed7033c8 100644 --- a/srsepc/hdr/mme/mme_gtpc.h +++ b/srsepc/hdr/mme/mme_gtpc.h @@ -66,9 +66,8 @@ private: virtual ~mme_gtpc(); static mme_gtpc* m_instance; - srslte::log_filter* m_mme_gtpc_log; - srslte::byte_buffer_pool* m_pool; - s1ap* m_s1ap; + srslte::log_filter* m_mme_gtpc_log; + s1ap* m_s1ap; uint32_t m_next_ctrl_teid; std::map m_mme_ctr_teid_to_imsi; diff --git a/srsue/test/phy/ue_phy_test.cc b/srsue/test/phy/ue_phy_test.cc index 63b7d9e9d..352205525 100644 --- a/srsue/test/phy/ue_phy_test.cc +++ b/srsue/test/phy/ue_phy_test.cc @@ -62,7 +62,7 @@ class phy_test_bench : public srslte::thread { private: // Dummy classes - class dummy_stack : public srsue::stack_interface_phy_lte + class dummy_stack final : public srsue::stack_interface_phy_lte { private: srslte::log_filter log_h;