https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48379
Adam Badura <adam.f.badura at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |adam.f.badura at gmail dot com
--- Comment #6 from Adam Badura <adam.f.badura at gmail dot com> ---
To help others who might get here like I did, if you are using macros for
logging/printing (that eventually call printf-like functions) or are willing to
use them, _Pragma could be used to silence the warning "locally", like this
(https://godbolt.org/z/5oYPhjen9):
#include <cstdio>
#define LOG(fmt, ...) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdouble-promotion\"") \
std::printf(fmt, __VA_ARGS__); \
_Pragma("GCC diagnostic pop") \
void test(float f)
{
LOG("%f", f);
}