Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to compile in vc14 #25

Open
guruofquality opened this issue Jan 4, 2020 · 0 comments
Open

Fixes to compile in vc14 #25

guruofquality opened this issue Jan 4, 2020 · 0 comments
Assignees
Labels

Comments

@guruofquality
Copy link
Contributor

With the recent logger fix I was able to build umtrx again, but I needed a few more changes:

  • umtrx_eeprom.cpp missing an include
  • And an issue in the new logger stuff where the ternary operator and uhd::_log::log constructor looses the reference type and tries to copy the log object. The current macro might be a little bit compiler specific because of that. My solution below was to make a helper function:
diff --git a/host/umtrx_eeprom.cpp b/host/umtrx_eeprom.cpp
index ef6a09d8..083a8fe5 100644
--- a/host/umtrx_eeprom.cpp
+++ b/host/umtrx_eeprom.cpp
@@ -15,6 +15,7 @@
 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
+#include "umtrx_impl.hpp"
 #include <uhd/usrp/mboard_eeprom.hpp>
 #include <uhd/types/mac_addr.hpp>
 #include <uhd/types/byte_vector.hpp>
diff --git a/host/umtrx_log_adapter.hpp b/host/umtrx_log_adapter.hpp
index c41d2754..df091ba6 100644
--- a/host/umtrx_log_adapter.hpp
+++ b/host/umtrx_log_adapter.hpp
@@ -9,15 +9,23 @@
 #else // UHD_HAS_MSG_HPP
 #include <uhd/utils/log.hpp>
 
-enum {
+enum _umtrx_uhd_log_level_t {
     _uhd_log_level_status,
     _uhd_log_level_warning,
     _uhd_log_level_error
 };
 
-#define UHD_MSG(severity) ((_uhd_log_level_##severity==_uhd_log_level_status)?UHD_LOGGER_INFO("UmTRX"): \
-                           (_uhd_log_level_##severity==_uhd_log_level_warning)?UHD_LOGGER_WARNING("UmTRX"): \
-                           UHD_LOGGER_ERROR("UmTRX"))
+static inline uhd::_log::log &_umtrx_get_uhd_logger(const _umtrx_uhd_log_level_t level)
+{
+    switch(level)
+    {
+    case _uhd_log_level_status: return UHD_LOGGER_INFO("UmTRX");
+    case _uhd_log_level_warning: return UHD_LOGGER_WARNING("UmTRX");
+    case _uhd_log_level_error: return UHD_LOGGER_ERROR("UmTRX");
+    }
+}
+
+#define UHD_MSG(severity) (_umtrx_get_uhd_logger(_uhd_log_level_##severity))
 
 #endif // UHD_HAS_MSG_HPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants