Merge pull request #8114 from volta-networks/fix_c++_xrefdata

lib: fix c++ usage of zlog
This commit is contained in:
David Lamparter 2021-02-22 14:52:37 +01:00 committed by GitHub
commit b6be812717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,12 +84,16 @@ static inline void zlog_ref(const struct xref_logmsg *xref,
va_end(ap);
}
#define _zlog_ref(prio, msg, ...) do { \
#define _zlog_ref(prio, msg, ...) \
do { \
static struct xrefdata _xrefdata = { \
.xref = NULL, \
.uid = {}, \
.hashstr = (msg), \
.hashu32 = {(prio), 0}, \
}; \
static const struct xref_logmsg _xref __attribute__((used)) = {\
static const struct xref_logmsg _xref __attribute__( \
(used)) = { \
.xref = XREF_INIT(XREFT_LOGMSG, &_xrefdata, __func__), \
.fmtstring = (msg), \
.priority = (prio), \
@ -104,12 +108,16 @@ static inline void zlog_ref(const struct xref_logmsg *xref,
#define zlog_notice(...) _zlog_ref(LOG_NOTICE, __VA_ARGS__)
#define zlog_debug(...) _zlog_ref(LOG_DEBUG, __VA_ARGS__)
#define _zlog_ecref(ec_, prio, msg, ...) do { \
#define _zlog_ecref(ec_, prio, msg, ...) \
do { \
static struct xrefdata _xrefdata = { \
.xref = NULL, \
.uid = {}, \
.hashstr = (msg), \
.hashu32 = {(prio), (ec_)}, \
}; \
static const struct xref_logmsg _xref __attribute__((used)) = {\
static const struct xref_logmsg _xref __attribute__( \
(used)) = { \
.xref = XREF_INIT(XREFT_LOGMSG, &_xrefdata, __func__), \
.fmtstring = (msg), \
.priority = (prio), \