mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
warnOnce(): Fix boost exception when the message contains a format character
This commit is contained in:
parent
cbade16f9e
commit
241dd5481e
3 changed files with 6 additions and 10 deletions
|
@ -52,7 +52,7 @@ SourcePath EvalState::decodePath(std::string_view s, PosIdx pos)
|
||||||
SourcePath path {accessor->second, CanonPath(s)};
|
SourcePath path {accessor->second, CanonPath(s)};
|
||||||
|
|
||||||
static bool warned = false;
|
static bool warned = false;
|
||||||
warnOnce(warned, fmt("applying 'toString' to path '%s' and then accessing it is deprecated, at %s", path, positions[pos]));
|
warnOnce(warned, "applying 'toString' to path '%s' and then accessing it is deprecated, at %s", path, positions[pos]);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
} catch (std::invalid_argument & e) {
|
} catch (std::invalid_argument & e) {
|
||||||
|
|
|
@ -105,14 +105,6 @@ public:
|
||||||
|
|
||||||
Verbosity verbosity = lvlInfo;
|
Verbosity verbosity = lvlInfo;
|
||||||
|
|
||||||
void warnOnce(bool & haveWarned, const FormatOrString & fs)
|
|
||||||
{
|
|
||||||
if (!haveWarned) {
|
|
||||||
warn(fs.s);
|
|
||||||
haveWarned = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeToStderr(std::string_view s)
|
void writeToStderr(std::string_view s)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -225,7 +225,11 @@ inline void warn(const std::string & fs, const Args & ... args)
|
||||||
logger->warn(f.str());
|
logger->warn(f.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void warnOnce(bool & haveWarned, const FormatOrString & fs);
|
#define warnOnce(haveWarned, args...) \
|
||||||
|
if (!haveWarned) { \
|
||||||
|
haveWarned = true; \
|
||||||
|
warn(args); \
|
||||||
|
}
|
||||||
|
|
||||||
void writeToStderr(std::string_view s);
|
void writeToStderr(std::string_view s);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue