You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since glog 0.4.0, the LOG_IF Macro is defined as follow: #define LOG_IF(severity, condition) static_cast<void>(0), !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) static_cast<void>(0) is added. This change is from the commit Protect macros from user code to the left of them. I understand that case.
In our code, we have macros defined as follow:
#define RECORD_DATA_NORMAL_MACRO(type_name, data_type, logger, timestamp, ...) do { ...... logger << "Timestamp: " << timestamp << ", time consuming: " << duration.count() / 1000 << " ms"; } while (0)
The macro is used below: RECORD_OD_DATA(d_res, t_res, param_list, perc_msg->time_stamp_, VLOG(0));
You can see that VLOG(0) is a macro argument. When the macro is expanded, we get compiling error because static_cast<void>(0) exists. If we remove it, the error is gone.
Thanks!
The text was updated successfully, but these errors were encountered:
I don't see how this is a glog issue. The problem is clearly caused by the way you use VLOG. You cannot expect glog macros to defined in a certain way. Rather, your implementation must be able to deal with the provided definition.
Since glog 0.4.0, the LOG_IF Macro is defined as follow:
#define LOG_IF(severity, condition) static_cast<void>(0), !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
static_cast<void>(0)
is added. This change is from the commit Protect macros from user code to the left of them. I understand that case.In our code, we have macros defined as follow:
#define RECORD_DATA_NORMAL_MACRO(type_name, data_type, logger, timestamp, ...)
do {
......
logger << "Timestamp: " << timestamp << ", time consuming: " << duration.count() / 1000 << " ms";
} while (0)
#define RECORD_OD_DATA(res, t_res, param, timestamp, logger)
RECORD_DATA_NORMAL_MACRO("Od", Tools::ImageBevOdData, logger, timestamp, res, t_res, param, timestamp)
The macro is used below:
RECORD_OD_DATA(d_res, t_res, param_list, perc_msg->time_stamp_, VLOG(0));
You can see that VLOG(0) is a macro argument. When the macro is expanded, we get compiling error because
static_cast<void>(0)
exists. If we remove it, the error is gone.Thanks!
The text was updated successfully, but these errors were encountered: