https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89082
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |marxin at gcc dot gnu.org
Resolution|--- |WONTFIX
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Maybe I can offer c++20 [[likely]] and [[unlikely]] attribute:
https://en.cppreference.com/w/cpp/language/attributes/likely
example usage:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/g++.dg/cpp2a/attr-likely1.C
And yes, putting cold attribute on the PRINT_ERR function is what you're
seeking for. I guess it's desired to factor out the code to a function as it's
very unlikely the function will be executed. On the contrary, macro expansion
will cause the printing code will occupy space in the function.
That said, I'm closing as invalid as we provide various solutions.