glog
glog copied to clipboard
NullStream constructor and deconstructor not optimized away with GOOGLE_STRIP_LOG
When compiling with gcc 13.1 (and other version) and using GOOGLE_STRIP_LOG the output gets optimized away as expected. However, the constructor and deconstruction calls of NullStream() are left over in the compiled program.
I copied together from 3a0d4d22c5ae0b9a2216988411cfa6bf860cc372 with a cmake -DCMAKE_BUILD_TYPE=Release .. generated output.
Link to compiler explorer See line 518 in compiler output
Good catch!
After looking into the issue, I believe something like this could work. NullStream should probably not derive from LogMessage::LogStream to allow the compiler to optimize the corresponding symbols away.