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.
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.
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!