I have a logging facility which is basically a wrapper around glog + some utility functions which I regularly need. This code is in use for quite some time and compiles on different platforms (Intel Mac, Ubuntu, Debian) and compilers (gcc, clang) just fine. However, I cannot get the code compiled on Alpine with musl.
The error is as follows:
src/../include/Logging.hpp:52:30: error: expected primary-expression before 'while'
52 | #define myAssert(condition) DCHECK(condition)
| ^~~~~~
The macro in my Logging.hpp is defined as follows:
// Only gets compiled for debug configuration
#define myAssert(condition) DCHECK(condition)
There are a bunch of macros relating to DCHECK in glog's logging.h file, thus I just link the related file: https://github.com/google/glog/blob/master/src/glog/logging.h.in
Relevant should be the following lines:
- https://github.com/google/glog/blob/05fbc65278db1aa545ca5cb743c31bc717a48d0f/src/glog/logging.h.in#L1327
- https://github.com/google/glog/blob/05fbc65278db1aa545ca5cb743c31bc717a48d0f/src/glog/logging.h.in#L1368
Why doesn't that work as expected? The only thing I see as potential candidate is this GLOG_MSVC_PUSH_DISABLE_WARNING, but this also expands to a no-op.