libutil: remove warnOnce macro

it's only used once, and even that one use is highly questionable. more
instances of warnOnce should be much more principled than this has been

Change-Id: I5856570c99cb44462e700d753d0c706a5db03c4b
This commit is contained in:
eldritch horrors 2024-07-14 22:43:50 +02:00
parent 22252825c4
commit d8c09b5836
2 changed files with 7 additions and 9 deletions

View file

@ -33,9 +33,13 @@ void printGCWarning()
{ {
if (!gcWarning) return; if (!gcWarning) return;
static bool haveWarned = false; static bool haveWarned = false;
warnOnce(haveWarned, if (!haveWarned) {
haveWarned = true;
warn(
"you did not specify '--add-root'; " "you did not specify '--add-root'; "
"the result might be removed by the garbage collector"); "the result might be removed by the garbage collector"
);
}
} }

View file

@ -283,12 +283,6 @@ inline void warn(const std::string & fs, const Args & ... args)
logger->warn(HintFmt(fs, args...).str()); logger->warn(HintFmt(fs, args...).str());
} }
#define warnOnce(haveWarned, args...) \
if (!haveWarned) { \
haveWarned = true; \
warn(args); \
}
void writeToStderr(std::string_view s); void writeToStderr(std::string_view s);
} }