Skip to content

Commit

Permalink
Avoid double parens for conditional logging in YARP 3.9+
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jan 12, 2024
1 parent 43a3542 commit e1bf8c4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/YarpPlugins/Jr3Mbed/Jr3Mbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <cstdint>
#include <cstring> // std::memcpy

#include <yarp/conf/version.h>

#include <yarp/os/LogStream.h>

#include "LogComponent.hpp"
Expand All @@ -15,17 +17,29 @@ using namespace roboticslab;

bool Jr3Mbed::performRequest(const std::string & cmd, const can_message & msg, std::uint8_t * response, bool quiet)
{
#if YARP_VERSION_COMPARE(>=, 3, 9, 0)
yCIInfo(quiet ? JR3M_QUIET : JR3M, id()) << "Sending" << cmd << "command";
#else
yCIInfo((quiet ? JR3M_QUIET : JR3M), id()) << "Sending" << cmd << "command";
#endif

if (!sender || !sender->prepareMessage(msg))
{
#if YARP_VERSION_COMPARE(>=, 3, 9, 0)
yCIWarning(quiet ? JR3M_QUIET : JR3M, id()) << "Unable to register" << cmd << "command";
#else
yCIWarning((quiet ? JR3M_QUIET : JR3M), id()) << "Unable to register" << cmd << "command";
#endif
return false;
}

if (!ackStateObserver->await(response))
{
#if YARP_VERSION_COMPARE(>=, 3, 9, 0)
yCIWarning(quiet ? JR3M_QUIET : JR3M, id()) << "Command" << cmd << "timed out";
#else
yCIWarning((quiet ? JR3M_QUIET : JR3M), id()) << "Command" << cmd << "timed out";
#endif
return false;
}

Expand Down

0 comments on commit e1bf8c4

Please sign in to comment.