Win32Fatal: support a "hint" for the error
The callsite might have extra context which is helpful for interpreting
the error message.
diff --git a/src/util.cc b/src/util.cc
index 760bc23..8e67fd9 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -432,8 +432,12 @@
return msg;
}
-void Win32Fatal(const char* function) {
- Fatal("%s: %s", function, GetLastErrorString().c_str());
+void Win32Fatal(const char* function, const char* hint) {
+ if (hint) {
+ Fatal("%s: %s (%s)", function, GetLastErrorString().c_str(), hint);
+ } else {
+ Fatal("%s: %s", function, GetLastErrorString().c_str());
+ }
}
#endif
diff --git a/src/util.h b/src/util.h
index 1b4227c..6a4a7a9 100644
--- a/src/util.h
+++ b/src/util.h
@@ -119,7 +119,7 @@
string GetLastErrorString();
/// Calls Fatal() with a function name and GetLastErrorString.
-NORETURN void Win32Fatal(const char* function);
+NORETURN void Win32Fatal(const char* function, const char* hint = NULL);
#endif
#endif // NINJA_UTIL_H_