diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index af7f46d87..a407c647f 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -33,9 +33,13 @@ void printGCWarning() { if (!gcWarning) return; static bool haveWarned = false; - warnOnce(haveWarned, - "you did not specify '--add-root'; " - "the result might be removed by the garbage collector"); + if (!haveWarned) { + haveWarned = true; + warn( + "you did not specify '--add-root'; " + "the result might be removed by the garbage collector" + ); + } } diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 7990ffce0..96f9f0782 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -283,12 +283,6 @@ inline void warn(const std::string & fs, const Args & ... args) logger->warn(HintFmt(fs, args...).str()); } -#define warnOnce(haveWarned, args...) \ - if (!haveWarned) { \ - haveWarned = true; \ - warn(args); \ - } - void writeToStderr(std::string_view s); }